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

Re: shell escape problem?



Matt Price <matt.price@utoronto.ca> writes:

> hi folks,
>
> I've written a little shell that generates this string and calls it
> $CMD: (sorry no line breaks):
>
> multi-gnome-terminal --add-window -T --tname==.teaching/ --tcommand="mutt -f =.teaching/" -T --tname==.moin/ --tcommand="mutt -f =.moin/" -T --tname==.mycroft --tcommand="mutt -f =.mycroft" -T --tname==.evilbitch --tcommand="mutt -f =.evilbitch" -T --tname==.bibliography/ --tcommand="mutt -f =.bibliography/" -T --tname==.dufferin-grove --tcommand="mutt -f =.dufferin-grove" -T --tname=+.Carfreeday --tcommand="mutt -f +.Carfreeday" -T --tname=+.IN_xml_openoffice --tcommand="mutt -f +.IN_xml_openoffice" -T --tname=+.IN_Pessimism --tcommand="mutt -f +.IN_Pessimism"
>
> when I type this command in manualy, it executes perfectly.  But when
> I try to execute this line in the script:
> $CMD
>
> I get an error 
> "Error on option -f: unknown option.  Run 'multi-gnome-terminal
> --help' to see a full list of available command line options."
>
> so it looks to as though the quotation marks that are working fine
> when entered directly are somehow interfered with in the $CMD version.
> Probalby this is obvious but I don't see it -- any hints?

Your problem is not the call $CMD but the assignment CMD=blah
There the (double) quotes apparently are stripped off. Put the right
hand side in single quotes CMD='blah' and you should be fine
(well, at least as long as blah contains no single quotes; if
it does, just escape them per backslash).

Regards, Bruno.



Reply to: