bug-bash
[Top][All Lists]
Advanced

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

Re: Quotes inserted into command


From: Andreas Schwab
Subject: Re: Quotes inserted into command
Date: Tue, 22 May 2007 23:02:59 +0200
User-agent: Gnus/5.110006 (No Gnus v0.6) Emacs/22.0.97 (gnu/linux)

"Matt Kane" <address@hidden> writes:

> Hello,
>
> I've got a script that does the following:
> JAVA=/usr/bin/java
> JAVA_W_CLASSPATH="$JAVA -cp \"$classpath\" "
> $JAVA_W_CLASSPATH com.choicestream.foo
> echo $JAVA_W_CLASSPATH
>
> I've noticed that on different versions of bash, it behaves differently.
> Bash 3.0 will execute:
> /usr/bin/java -cp "/path/to/classes" com.choicestream.foo
> And display the same.
>
> But Bash 3.1 and 3.2 put single quotes around the double quotes when
> executing.
> /usr/bin/java -cp '"/path/to/classes"' com.choicestream.foo
> But it will display:
> /usr/bin/java -cp "/path/to/classes" com.choicestream.foo

There is no difference between the versions, the executed command is
always the same.  If you want the quotes to be reinterpreted you need to
use eval.

Andreas.

-- 
Andreas Schwab, SuSE Labs, address@hidden
SuSE Linux Products GmbH, Maxfeldstraße 5, 90409 Nürnberg, Germany
PGP key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."




reply via email to

[Prev in Thread] Current Thread [Next in Thread]