Example script: ex5.sh


   1: #!/bin/sh
   2: echo "Example of unquoted here document, with variable and command substitution"
   3: 
   4: cat <<EOF
   5:  This text will be fed to the "cat" program as 
   6:  standard input.  It will also have variable
   7:  and command substitutions performed.
   8:  I am logged in as $USER and today is `date`
   9: EOF
  10: echo
  11: echo "Example of quoted here document, with no variable or command substitution"
  12: # The terminating string must be at the start of a line.
  13: cat <<"EndOfInput"
  14:  This text will be fed to the "cat" program as standard
  15:  input.  Since the text string marking the end was quoted, it does not get 
  16:  variable and command subsitutions.
  17:  I am logged in as $USER and today is `date`
  18: EndOfInput



  last modified 22/03/2012 Introduction Table of Contents
(frame/no frame)
Printable
(single file)
© Dartmouth College