Turning off variable substitution

Enter the following script to see how to avoid a variable substitution in these files:

  1. Save the script under the name here_no.sh, shown as follows:
filename="test1" 
cat <<'Quoted_End_Marker' 
When we add quotes before and after here 
Document marker, we can include variables 
Such as $USER, $PATH, $name and similar 
Quoted_End_Marker 
  1. When you run this script, you will see output like the following:
    $ bash here_no.sh
  
  1. Here is the output:
When we add quotes before and after here 
Document marker, we can include variables 
Such as $USER, $PATH, $name and similar 

This script uses an ordinary here file, but it turns off the variable substitution. Otherwise, you would see the values of $HOME, $filename, and ...

Get Learning Linux Shell Scripting - Second Edition now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.