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
  • 280,126
  • 43
  • 390
  • 441
Kuan
  • 11,149
  • 23
  • 93
  • 201

1 Answers1

9

! 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,747
  • 1
  • 18
  • 33
  • 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