Matt Kane wrote: > 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 > > I don't understand the reason for the discrepancy, and searching for "bash > quotes" gives me a lot of bash.org nonsense.
I assume you mean the output of `bash -x' or `set -x' when you say "when executing". The idea is that the output of bash -x should be reusable as input. The bash-3.1 and later output is. The bash-3.0 output is not, since the double quotes, which should be a literal part of the command, are not escaped to prevent them being removed during word expansion. Chet -- ``The lyf so short, the craft so long to lerne.'' - Chaucer Live Strong. No day but today. Chet Ramey, ITS, CWRU [EMAIL PROTECTED] http://cnswww.cns.cwru.edu/~chet/ _______________________________________________ Bug-bash mailing list Bug-bash@gnu.org http://lists.gnu.org/mailman/listinfo/bug-bash