On Wednesday, March 13, 2002, at 07:25 PM, Iago wrote:
> On Wed, 13 Mar 2002, Gary Blackburn wrote:
>
>> Anyone have any idea what's going on? The "!" isn't one of the
>> metcharacters, and all this code works exactly as expected whenever you
>> run it within an actual Perl file (i.e., not from a one-liner.) I tried
>> this code on Linux and ActiveState Perl and everything works fine,
>> which
>> makes me think it's an OS X/Darwin thing. Thoughts? Thanks!
>
> It's the shell that's doing it -- the ! operator is telling the shell
> to (in short) do stuff... when you're escaping the !, you're escaping
> it for the shell, not for perl.
>
> --
> Fred Hicks <[EMAIL PROTECTED]>
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?
<later>
After consulting the tcsh man page ! begins a "history substitution" and
can occur "anywhere in the input stream" unless it's "followed by a
blank, tab, newline, `=' or `(' "
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.
I don't a lot of programming from the shell, but for those of you that
do, is this a good thing? Is this sort of thing really helpful or does
it make you run screaming for other shells that don't do this (like
bash, which is what the Linux box I tested was using.)?
Thanks for the quick response!
---
Gary Blackburn
[EMAIL PROTECTED]