How to escape bash parameter expansion (when a “!” followed by letters is a parameter)

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP


How to escape bash parameter expansion (when a “!” followed by letters is a parameter)



I have a bash script I need to call with a string parameter, which string starts with a exclamation mark "!" (this is mandatory in what I'm doing):


myCommand.sh "!HELLO"



Because of parameter expansion, bash reports an error:


-bash: !HELLO: event not found



Is there any way to escape the "!" that produces this? Another way to pass such parameter?





Use single quotes: myCommand.sh '!HELLO'
– anubhava
43 secs ago


myCommand.sh '!HELLO'









By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Popular posts from this blog

Arduino Mega cannot recieve any sketches, stk500_recv() programmer is not responding

Visual Studio Code: How to configure includePath for better IntelliSense results

C++ virtual function: Base class function is called instead of derived