I am writing a shell script where I input a value and want to use the value for some other commands. My problem is that I want to escape this value.
For example, if I input http://example.com
in the following script
echo "Input a value for my_value"
read my_value
echo $my_value
It will result in http://example.com
But the result I wish is http\:\/\/example\.com
How do I achieve this?
The command I'm trying to run is
sed -i s/url/$my_value/g somefile.html
without the escape it becomes sed -i s/url/http://example.com/g somefile.html
which obviously is a syntax error..