How can I get shell to read special characters as strings? Such as $ or !
Code:
$ ./test.sh "!hooray!"
bash: !hooray!: event not found
$ ./test.sh !hooray!
bash: !hooray!: event not found
If I escape it, the \ prints in the output:
Code:
$ ./test.sh "\!hooray\!"
\!hooray\!
The code of test.sh is as follows:
Code:
$ cat test.sh
#!/bin/bash
str="$1"
echo "$str"
TIA