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

Re: shell escape problem?



Hello Matt,

On Fri, Apr 08, 2005 at 04:51:58PM -0400, Matt Price wrote:
> 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"

You must really *love* mutt! ;-) Ah well, so do I. :)

> 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?

I can't give an instant solution, but some hints are no problem. :) 

I don't have that multi-gnome-thingy here, so it's hard to give exact
help. I wonder which '-f' gives the problem here: the first or the
second. Try to get it working for just one mutt session and work your
way from there:

multi-gnome-terminal --add-window -T --tname==.teaching/ --tcommand="mutt -f =.teaching/"

If that doesn't work, try escaping the quotes:

multi-gnome-terminal --add-window -T --tname==.teaching/ --tcommand=\"mutt -f =.teaching/\"

The complete line should probably be something like:

CMD="multi-gnome-terminal blabla"

so enclosed in quotes itself. If that doesn't work try single quotes.

CMD='multi-gnome-terminal blabla'


Here are some simpler commands with quotes that may or may not give a
clue:

$ echo "Hello"
Hello
$ CMD=echo "Hello"
bash: Hello: command not found
$ CMD="echo "Hello""; $CMD
Hello
$ CMD="echo \"Hello\""; $CMD
"Hello"
$ CMD="echo \"Hello\""; "$CMD"
bash: echo "Hello": command not found


HTH,

-- 
Maurits van Rees | http://maurits.vanrees.org/ [Dutch/Nederlands] 
Public GnuPG key: keyserver.net ID 0x1735C5C2
"Let your advance worrying become advance thinking and planning."
 - Winston Churchill

Attachment: signature.asc
Description: Digital signature


Reply to: