Subject: Re: shell expansions
To: Wolfgang Rupprecht <wolfgang@wsrcc.com>
From: gabriel rosenkoetter <gr@eclipsed.net>
List: current-users
Date: 07/29/2000 18:48:38
On Sat, Jul 29, 2000 at 12:42:13AM -0700, Wolfgang Rupprecht wrote:
>
> Are shells allowed to expand '!'s inside double quotes? The most
> recent bash (2.04.0(1)-release (i386--netbsd)) gripes about the
> following:
>
> $ echo "ouch!"
> bash: !": event not found
>
> In contrast, /bin/sh echos "ouch!" exactly as I had expected.
... and zsh yields:
ambriel:~% echo "ouch!"
dquote> "
ouch
ambriel:~%
(It can't find !", but it's not going to complain till you close those
damn quotes... when it proceeds not to complain, but to drop the !
entirely.)
Personally, I *like* the fact that command history is expanded in
double quotes. That could be pretty handy. If you didn't want
expansion, you should have used single quotes. If you're using double
quotes, you're thinking about expansion, and you should escape
anything worrisome.
~ g r @ eclipsed.net