Mail Archives: cygwin/2007/01/15/22:36:51
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
According to Luke Kendall on 1/15/2007 8:15 PM:
> I also just wrote this which fails with a "line 2: !": event not found":
>
> #!/bin/sh
> echo "Hello world!"
>
>
> SHELLOPTS=braceexpand:emacs:hashall:histexpand:history:igncr:interactive-comments:monitor
There you go. You have "history" enabled in SHELLOPTS, which is a
non-POSIX extension, and explains why /bin/sh is not doing what you
expected. Your shell scripts are inheriting interactive behavior, and
trying to do history expansion when they encounter !. I still hope to
find time to getting around and trying to teach bash which options in
SHELLOPTS should be ignored when starting a non-interactive session. In
the meantime, I would recommend turning history off, or at least changing
the history expansion character, if you absolutely must set SHELLOPTS.
And if all else fails, and you are still running scripts with history
enabled, then according to bash documentation, the only way to bypass the
history character is to quote it, but that in double quotes, "\!"
preserves the \, so you have to write something like:
echo "Hello world"\!
- --
Don't work too hard, make some time for fun as well!
Eric Blake ebb9 AT byu DOT net
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.5 (Cygwin)
Comment: Public key at home.comcast.net/~ericblake/eblake.gpg
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
iD8DBQFFrEhQ84KuGfSFAYARAjETAJ9u/299Pot4ugAvPVh+Z/vVTiovIwCgmsWw
IdFw+6CYppgCfJojwFAjF4M=
=lbyV
-----END PGP SIGNATURE-----
--
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple
Problem reports: http://cygwin.com/problems.html
Documentation: http://cygwin.com/docs.html
FAQ: http://cygwin.com/faq/
- Raw text -