printing single quote in double quotes in .zsh

Viewed 28

I am trying to write the following in a file using echo. I want to print "'" in the file also. I tried to escape all but did not help. Can someone please help how can i escape all chars in this text so i print exactly the text below (in bold)

echo 'grep -q '^export MYVAR=.$' $filepath && sed -i '' 's/export MYVAR=.$/export MYVAR="'"$somevar"'"/g' $filepath || echo 'export MYVAR="'"$somevar"'"' >> $filepath' >> /path/to/file.txt

0 Answers
Related