I tried the approach in http://superuser.com/a/462871 and it works. But I don't want my gmail password to be stored in command history. Is there a way to avoid this?
If you are using a Bash shell then try adding a space to the beginning of the command you enter.
If that does not work then add [ \t]* to HISTIGNORE.