question: text substitution using Perl

Steven W. Orr steveo at syslang.net
Mon Oct 23 15:28:33 EDT 2006


On Monday, Oct 23rd 2006 at 14:55 -0400, quoth Zhao Peng:

=>Mike and Kevin,
=>
=>Thank you both for quick, detailed, and crystal clarification and 
=>explanation.
=>
=>Just one more question:
=>
=>"To the shell, anything inside of single quotes is a single argument, so all
=>of the spaces, newlines, etc. in there are passed without shell
=>interpretation" (quoted from the Mike's answer to my 2nd question).
=>
=>Can this claim also be extended for double quotes?
=>
=>Thanks,
=>Zhao
=>
=>mike ledoux wrote:
=>
=>> The backslash on line 3 is interpreted by the shell as a line
=>> continuation, so yes, it is just for increased readability by
=>> letting you break a long command line over multiple lines.  It is
=>> not needed at the end of line 2 because the end of line 2 is inside
=>> of single quotes.  To the shell, anything inside of single quotes is
=>> a single argument, so all of the spaces, newlines, etc. in there are
=>> passed without shell interpretation.

The difference between single quotes and double quotes is strictly 
whether variable interpolation occurs. 

foo=hello
echo foo
echo $foo
echo '$foo'
echo "$foo is a 5 letter word"

Just for fun, this is a good example to help understand.

echo "$PATH"
ssh goofy "echo $PATH"
ssh goofy 'echo $PATH'

The first will tell you your path. The second will tel goofy to you your 
path and the third will tell goofy to tell you your path on goofy because 
what will be seen by goofy will be $PATH instead of the expansion of 
$PATH.


-- 
A: Maybe because some people are too annoyed by top-posting.
Q: Why do I not get an answer to my question(s)?
A: Because it messes up the order in which people normally read text.
Q: Why is top-posting such a bad thing?


More information about the gnhlug-discuss mailing list