Bash: Error in Export Command That Bash: !St: Event Not Found

Bash: Error in Export Command That Bash: !St: Event Not Found

When i tried to excute the following export SENTRY_SECRET_KEY="k(#!st-6eb2y74=@^6s7a67fy5a&@p3y=57#aszb@hs)n^vv0#" I get the error "bash: !st: event not found" Please give me solution..

2 Answers

Use ' instead of " and your variable export will work.

The '!' is interpreted as a history invocation, so your command history is searched for 'st' which causes an 'event not found' message.

You can verify this with the following sequence:

ls /etc
a="k!ls"
b='k!ls'

and then:

$ echo $a
kls /etc
$ echo $b
k!ls

Please Use single quotes (') instead double quotes ("). Strings and special characters inside single quotes usage in bash variables are interpreted literally. For an example the usage of ! or $ symbols inside double quotes are interpreted as special characters. Please read more into the documentation. So your command will look like:

export SENTRY_SECRET_KEY='k(#!st-6eb2y74=@^6s7a67fy5a&@p3y=57#aszb@hs)n^vv0#'

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

James H. Sterling
Author

James H. Sterling

James Sterling reports on renewable energy developments, climate policy, ecological conservation, and green tech innovations around the globe.