2

When I try to use export password="abcd!0", the base gave me an error: !0: event not found

Any help to solve this?

Charles Duffy
  • 257,635
  • 38
  • 339
  • 400
Kuan
  • 10,615
  • 22
  • 82
  • 183

1 Answers1

8

! is a special character to bash it is used to refer to previous commands; eg,

!rm

will recall and execute the last command that began with the string "rm"

Try:

export password="abcd\!1"

or

 export password='abcd!1'
Oz Bar-Shalom
  • 1,671
  • 1
  • 16
  • 31
  • You might also suggest `set +H` in one's `~/.bashrc` to turn this off, making strings starting with `!` behave the same between the interactive command line and scripts. – Charles Duffy Oct 04 '16 at 22:04