I'm trying to execute this line of code, without the line break after "Audio" which is added, here, only to not show the horizontal scroll bar:
[exec mediainfo --Output=$'General;File Name: %FileName%\nAudio;
Duration: %Duration/String3%' 01_gen/01001.mp3]
which runs on the command line in Linux without the exec
; but it won't run in Tcl. The error is:
Usage: "mediainfo [-Options...] FileName1 [Filename2...]"
"mediainfo --Help" for displaying more information
I read about single quotes having "no special significance to Tcl" (at https://www.tcl.tk/man/tcl8.6/TclCmd/exec.html) and the example there appears to replace them with {}. And I tried escaping the $, but it generates the same error.
[exec mediainfo --Output=\${General;File Name: %FileName%\nAudio;
Duration: %Duration/String3%} 01_gen/01001.mp3]
I also tried escaping the semi-colons and it does not error, but it returns all the values rather than only those requested in the statement.
[exec mediainfo --Output=\${General\;File Name: %FileName%\nAudio\;
Duration: %Duration/String3%} 01_gen/01001.mp3]
I also tried a couple variations of the expansion method as pointed out in this SO question but the best I can get is a return of all the media properties rather than the two requested.
set cmd {mediainfo --Output=$'General;File Name: %FileName%\nAudio;
Duration: %Duration/String3%' 01_gen/01001.mp3}
chan puts stdout [exec {*}$cmd]
Would you please explaing what I'm doing wrong and need to do to get this to execute in Tcl?
Thank you.
Edit:
Now that Shawn has explained the issue, I realize that, had I read the first answer at SO question about mediainfo more closely (and was not ignorant concerning bash) I could have added the new line explicitly, making what that answer refers to as a template; and then just used normal Tcl substitution. Sometimes I can be pretty dense.
set param {--Output=General;File Name: %FileName%
Audio; Duration: %Duration/String3%}
chan puts stdout [exec mediainfo $param 01_gen/01001.mp3]
# File Name: 01001 Duration: 00:07:31.422