On Tue, Dec 20, 2016 at 12:39:12PM +0000, Hossein Vatani wrote: > Hi experts,I encountered a issue that i guessed a bug.i tried to make bash > script that generate strong password and save it with htpasswd command.if i > generate er"exc'oti!ot for password, i could not send it as string to > htpasswd and more strong, in command line i has this problem too."-bash: > !ot": event not found"i'm sure after solving above message i'ld faced > message(actualy not message)> > best regards.P.S. sorry for my english. it isn't my native language. :-)
It sounds like you've got csh-style history expansion enabled, which should not be the default behavior in a script. (It *is* the default in an interactive shell.) Try disabling it with "set +o histexpand". If you're actually working with an interactive shell and don't want to give up history expansion (even temporarily), you will just have to figure out how to work around the quoting hell you're stuck in. Try using single quotes instead of double quotes, or using $'...' quoting with backslash-escaped inner single quotes, or whatever it takes. I found it a lot easier just to: imadev:~$ head -2 .bashrc set -o vi set +o histexpand