Is there any way to turn off parameter expansion in here document?
Shell command:
$ cat > analyze.sh <<EOF
awk -F: '{print $NF}' asr.log | sort > tmp
awk -F '(' '{print $NF}' asr.log | awk '{print $1}' | sort > tmp2
EOF
I got this in analyze.sh:
awk -F: '{print }' asr.log | sort > tmp
awk -F '(' '{print }' asr.log | awk '{print }' | sort > tmp2
You need to quote the delimiter:
This prevents the shell from expanding the here-document:
Documentation
This is documented in
man bash
:You can quote the
EOF
to disable expansion: