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

Hi,

I'm not a shell script pro and I don't know much about POSIX, but I
have found this puzzling behavior in bash, and although it is
documented I don't really understand why bash behaves this way. I was
hoping someone could tell me.

[EMAIL PROTECTED]:~$ set -H
[EMAIL PROTECTED]:~$ echo "hi!"
bash: !": event not found
[EMAIL PROTECTED]:~$ echo "hi\!"
hi\!

This is somewhat unusual; generally, characters protected by
backslashes are put through *unescaped*. Compare:

[EMAIL PROTECTED]:~$ echo "\`"
`
[EMAIL PROTECTED]:~$ echo "\""
"
[EMAIL PROTECTED]:~$ echo "hi\$"
hi$

The manual page does say explicitly, under "Quoting":

The backslash preceding the ! is not removed.

But no explanation is given for why this behavior exists. Is it part
of POSIX compliance? An implementation detail?

Ethan
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFHEDFMhRlgoLPrRPwRAmj1AJ9Ch7mz87lP/NRm+8+ZqXUOULk1sACgh2Kw
1ArDcXwqPrDZOdWoz038t1E=
=7fHW
-----END PGP SIGNATURE-----


Reply via email to