$ 0 0 just escape the " like so: echo "cat file2.txt | sed 's/\"//g' > file3.txt ## Step 2 " >> ~/globalLog.txt