I am writing a script and I need to check a variable and get rid of any single quotes that may be in that variable. Could somebody give me an example of how to do this??
$1=s'sdfsdfs'
reason=$1
desired result:
reason=ssdfsdfs
please help.
I am writing a script and I need to check a variable and get rid of any single quotes that may be in that variable. Could somebody give me an example of how to do this??
$1=s'sdfsdfs'
reason=$1
desired result:
reason=ssdfsdfs
please help.
reason=`echo $1 | tr -d ["'"]`
Inside the brackets is a single-quote surrounded by double-quotes to protect its special meaning from the shell.
For example, to strip all x's, y's and z's from a string:
echo sxtyrizng | tr -d [xyz]