Problem escaping characters in bash script?

Prepend what will be executed with an echo, so you will see what will be passed to the commands something $args2 will expand to something -vf "in scale=580:380 T1,T1 pad=720:530:0:50 out i.e. Calling something with two arguments, one being an option (or 2 options) and the other is a "single" string; I suppose you don't want the double quotes.

Prepend what will be executed with an echo, so you will see what will be passed to the commands; something $args2 will expand to something -vf "in scale=580:380 T1,T1 pad=720:530:0:50 out " i.e. Calling something with two arguments, one being an option (or 2 options) and the other is a "single" string; I suppose you don't want the double quotes.

The line below has two problems. First, you cannot have spaces around the equals. Second, when you try to use a variable within a double-quoted string, you need to use curly braces.

Eppart1 = "$args0_$startingfrom_01_01_02. Mp4" What you need is this: eppart1="$args0_${startingfrom}_01_01_02. Mp4" Otherwise, bash will be looking for a variable identified by startingfrom_01_01_02, not startingfrom You seem to have this fixed in later lines so maybe you just pasted an older version?

Other than that, what the others said is correct: You should execute nothing but assignments and echos until you are sure your variables are correct.

I've been editing/trying various ways.. but all leads to that "args2" line which seems to be getting evaluated to do other stuff, eppart1,eppart2 aren't used (was part of testing/trying) – allenskd Apr 23 at 18:53.

Putting quotes inside a variable value (as you did with args2) does not do what you expect. Specifically, they won't be parsed as quotes when the variable is used, but just as regular characters. So if you do: args2='-vf "in scale=580:380 T1,T1 pad=720:530:0:50 out "' somecmd $args2 it winds up being equivalent to: somecmd '-vf' '"in' 'scale=580:380' 'T1,T1' 'pad=720:530:0:50' 'out' '"' note that the double-quotes aren't being interpreted as grouping words together, instead they're just passed to the command as parts of the words -- not what you want at all.

BTW, this is a case where debugging with echo won't help -- everything will look fine, because echo doesn't clearly separate the arguments it gets. Instead, using set -x will get bash to print the commands as it executes them, with its parsing clarified. Now, about fixing it.

If you need to store command arguments in a variable (as you're doing here) and keep track of where the word boundaries are (as you're trying to use double-quotes to do), the standard answer is to use arrays instead of simple variables. Create the array with each argument as an array element, then use the array with the idiom "${arrayname@}" (note that the double-quotes around it are very important). Here's my example above: args2=(-vf "in scale=580:380 T1,T1 pad=720:530:0:50 out ") somecmd "${args2@}" or in your script: ... args2=(-vf "in scale=580:380 T1,T1 pad=720:530:0:50 out ") ... /usr/local/bin/ffmpeg $args1 "$file" "${args2@}" $args3 "${args0}_${startingfrom}_01_01_02.

Mp4" mv "${args0}_${startingfrom}_01_01_02. Mp4" upload/ /usr/local/bin/ffmpeg $args12 "$file" "${args2@}" $args3 "${args0}_${startingfrom}_01_02_02. Mp4" ... BTW, doing the same thing to your other "arg" variables isn't necessary (since they don't contain any arguments with spaces in them), but wouldn't hurt and might be considered good practice.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions