in reply to Re: Command line question
in thread Command line question
I'm guessing that ${SOURCE} and friends are being interpolated somehow (even though they're in single quotes)
Those quotes are processed by the shell. In the bourne shell or a derivative like bash, single quote don't perform any interpolation.
$ echo "${PATH}" .:/home/ikegami/bin:/usr/local/bin:/usr/bin:/bin:/usr/bin/X11:/usr/gam +es $ echo '${PATH}' ${PATH}
( Here on end, assuming the bourne shell or a derivative like bash )
So Perl sees
BEGIN { $^I = ''; } while (<>) { s+${SOURCE}/${SAMS}/++g; s+${SOURCE}/${SAMLIB}/++g; s+${SOURCE}/${SMCLIB}/+${SOURCE}/${KENO}/+g; if ( not m+^${SOURCE}/+ ) { s+${SOURCE}/+\$$\{OBJECT\}/+g; print } }
On the other hand, Perl regexp and replace expressions *do* interpolate. So the above is equivalent to
BEGIN { $^I = ''; } while (<>) { s+//++g; s+//++g; s+//+//+g; if ( not m+^/+ ) { s+/+\${OBJECT}/+g; print } }
Depending on what the OP wants to do, he needs to use -e"" instead of -e'', to escape the dollar signs, or to define those variables in Perl.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: Command line question
by parv (Parson) on Jun 18, 2008 at 00:48 UTC | |
|
Re^3: Command line question
by kyle (Abbot) on Jun 18, 2008 at 00:34 UTC | |
by igotlongestname (Acolyte) on Jun 19, 2008 at 17:31 UTC | |
by kyle (Abbot) on Jun 19, 2008 at 18:58 UTC |