I have made a script which does mux a videofile, multiple audiofiles and multiple subtitles into one .mkv.
the script tries to run:
"/usr/bin/mkvmerge" -o "test.mkv" "--default-track" "0:yes" "--forced-track" "0:no" "--display-dimensions" "0:853x462" "-d" "0" "-A" "-S" "-T" "(" "mux.mkv" ")" "--language" "0:eng" "--default-track" "0:yes" "--forced-track" "0:no" "--no-global-tags" "--no-chapters" "-a" "0" "-D" "-S" "-T" "(" "test_eng_1.opus" ")" "--default-track" "0:no" "--forced-track" "0:no" "--no-global-tags" "--no-chapters" "-a" "0" "-D" "-S" "-T" "(" "test_und_2.opus" ")" "--language" "0:eng" "--default-track" "0:no" "--forced-track" "0:no" "--no-global-tags" "--no-chapters" "-s" "0" "-D" "-A" "-T" "(" "test_eng_3.idx" ")" "--language" "0:fra" "--default-track" "0:no" "--forced-track" "0:no" "--no-global-tags" "--no-chapters" "-s" "0" "-D" "-A" "-T" "(" "test_fra_5.idx" ")" "--language" "0:spa" "--default-track" "0:no" "--forced-track" "0:no" "--no-global-tags" "--no-chapters" "-s" "0" "-D" "-A" "-T" "(" "test_spa_4.idx" ")" "--title" "test"
If I run the script it shows: line 214: (the stuff above): No such file or directory
If I copy and paste the output and run it in bash all runs OK:
mkvmerge v7.7.0 ('Six Voices') 64bit built on Mar 3 2015 16:43:14 ...
Muxing took 3 seconds.
Here is the part of the script which tries to run mkvmerge:
213 mux="\"/usr/bin/mkvmerge\" -o \"$gname.mkv\" $muxvideo$muxaudio$muxsub$tacks$title"
214 "$mux"
Why does it run in the terminal but not in the script?
mux="\"/usr/bin/mkvmerge\" -o …"
and then"$mux"
? Why are you assigning the entire command to a variable like that (in the script)? Just do the same thing in the script that works in the terminal.