"!" interpretation in bash command line
Posted on 2011-03-03
In regard to commands entered at UNIX/Linux shell command lines (I'm not talking about scripts), if I do this in ksh, it works fine:
but in bash, the same command gives me this error:
!": event not found
I realise I can work around that by escaping the "!", like this:
but I still have some questions about the un-escaped command in bash:
1. Why do I get that error? Obviously "!" means something special in the bash command line, but what? I had a quick Google, to no avail, but I'd rather not take all day, and finding this in "man bash" could take ages too.
2. Why can I not up-arrow to go back through my command history, to that uncommand, and change it? It works for general commands containing syntax errors.
3. Is there a way to disable this behaviour in for the bash command line (i.e. so I don't have to escape the "!")?