Could you please help, does exist a command in bash to quote input argument?
script ./test.sh:
#!/bin/bash
echo ${1}
./test.sh "It costs $1"
This prints It costs, but how to print it as is It costs $1.
Of course it is possible to quote the argument directly in the command:
./test.sh "It costs \$1"
and it prints It costs $1. But how to quote it in the script?
UPDATED: It is possible with single quotes ./test.sh 'It costs $1'
echo "It costs \${1}", or with single quotes:echo 'It costs ${1}'.$1\$1will do the latter. If you run as-is with just./test.shyou'll get what you're seeing, but try./test.sh "a buck". For real clarity, read this manual, especially here & here.