-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On Wednesday, March 13, 2002, at 06:45 , Gary Blackburn wrote:

> I'm not a UNIX guru by any stretch of the imagination, but is 
> the shell supposed to be interfering here? I mean, I'm clearly 
> invoking the Perl binary, passing it a single command line 
> switch (-e) and then (what ought to be) a plain ol' string. 
> Where's the invitation for the shell to butt it's nose into my 
> business?

You implicitly invite the shell to stick its nose in your tent 
when you press the return key.

> Humph. How annoying... it appears that under tcsh I not only 
> have to worry about the various and sundry Perl metacharacters 
> but also a whole menagerie of tcsh metacharacters, too. Blech.

It's not a bug, it's a feature. :-) The shell automatically, 
silently, and predictably expands metacharacters (with some 
exceptions noted below) before invoking the command. That means 
that utilities like "cp" and "tar" don't have to be smart enough 
to know what to do with a filename like "*" -- they never see 
it. OTOH, it can confuse utilities like "find" that *do* know 
what to do with wildcards;

        find . -name *.pl

doesn't necessarily do what you want it to do, and you probably wanted

        find . -name '*.pl'

instead.

I don't want to get embroiled in shell religious wars, but I 
just looked in "Learning the bash Shell" (O'Reilly, 2nd 
edition), and on page 181 it says:

"All characters inside a pair of single quotes are untouched. 
You can't have single quotes inside single quotes -- not even if 
you precede them with backslashes." [1]

So, at least with bash, as long as you always wrap your -e 
string in single quotes, and remember to use either double 
quotes or the q() quotelike operator inside the string, you 
should have no nasty surprises. [2]

[1] There's a footnote in the book at this point about how you 
actually *can* put single quotes inside a single-quoted string, 
but that's beyond the scope of this email.

[2] Logic bugs in the Perl code notwithstanding. :-)

- --
Craig S. Cottingham
[EMAIL PROTECTED]
PGP key available from: 
<http://pgp.ai.mit.edu:11371/pks/lookup?op=get&search=0xA2FFBE41>
ID=0xA2FFBE41, fingerprint=6AA8 2E28 2404 8A95 B8FC 7EFC 136F 
0CEF A2FF BE41
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.6 (Darwin)
Comment: For info see http://www.gnupg.org

iD8DBQE8kCPXE28M76L/vkERArdjAJwIW4NT36lJ1YpX+zTQ+l1CqlLCHwCeNs8u
e2KwxWlm0JOYMt2K2eVBORY=
=u9YX
-----END PGP SIGNATURE-----

Reply via email to