3 ms·
That is incorrect. From the man page: If enabled, history expansion will be performed unless an ! appearing in double quotes is escaped using a ba
by egwynn 8y ago
That is incorrect. From the man page:
If enabled, history expansion will be performed
unless an ! appearing in double quotes is escaped
using a backslash.
- ben509 8y agoThe example works; it must be because a single ! doesn't expand to anything.
- egwynn 8y agoLooks like this is an artifact of the built-in (old) bash on osx. I see that it works in the newer versions of bash on my freebsd and linux hosts. The mac bash man page says: Only backslash (\) and single quotes can quote the history expansion character. where the newer man page says: Only backslash (\) and single quotes can quote the history expansion character, but the history expansion character is also treated as quoted if it immediately precedes the closing double quote in a double-quoted string. Thanks for pointing this out!
- ben509 8y agoSure, thanks for checking the man page! I usually just rip out bangs because I can never remember the rules for history expansion.
- deleted 8y ago[deleted]