At 4:25 PM -0800 3/13/2002, 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.
Yeah, what Fred said. The "stuff" it's doing is looking backwards through the history of commands entered on the command line and filling that in. Common examples are: !! for the previous command !-4 to go back four and execute that command !15 to use the 15th command (they're numbered when you call history) !vi to go back to the most recently used command starting with 'vi' So, for instance: % clear; !! % !-3 | less % ls -ld `!find` % bbedit "`!grep --files-with-matches`" -Charles [EMAIL PROTECTED]