Reputation: 227
I have a bash script that arrives like:
SCRIPT=$(curl .... | parsing...)
echo $SCRIPT > myfile
But when I try to echo
it in a file, some parts get evaluated. (Variables are substituted if any are defined, the *
character is replaced by all files in the working directory, etc...)
Can I prevent bash from evaluating any content of a variable, while still echo
ing?
Upvotes: 0
Views: 139
Reputation: 5155
Yes, use double quotes for that. I'll demonstrate:
$ x='*'
$ echo $x
..list of files..
$ echo '$x'
$x
$ echo "$x"
*
Upvotes: 1