Mailing List archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[vdr] Re: possible bug: VDR1.2.5 commandline interpreting



Am Dienstag, 21. Oktober 2003 21:09 schrieb Alfred Zastrow:
> What can I do, to hold the vdr-options in variables and still to create
> a dynamic command line?

Look into the bash manual to learn how quoting there really works. Since the 
shell expands quoting whenever encountered, the results are sometimes quite 
unexpected.. Look at this:

OPT="-Pxyz -x"
./vdr $OPT

In the first line, the shell expands the quotes, giving a variable that 
contains -Pxyz and -x as separate parameters. So VDR is called with two 
parameters actually.

OPT="-P\"xyz -x\""
./vdr $OPT

here OPT contains one parameter, namely -P"xyz -x" which is passed as one to 
VDR.

bash also behaves differently if you write

./vdr "$OPT"

which forces the shell to pass OPT as one parameter (although there are no 
escaped quotes inside OPT). So $OPT and "$OPT" are different. Same goes for 
arrays. All of $ARR, $ARR[*], "$ARR" and "$ARR[*]" behave different.

Bash quoting is hard, but somehow it all makes sense :-))

Greetings,
Sascha



-- 
Info:
To unsubscribe send a mail to ecartis@linuxtv.org with "unsubscribe vdr" as subject.



Home | Main Index | Thread Index