Hi all:

  I came across this ingenious way to invoke an awk script from within
a shell script. This is from Dave Taylor's book "Wicked Cool Shell
Scripts" :


#!/usr/bin/env ksh93

# diskspace - summarize available disk space and present in a logical
#    and readable fashion
________________________________
# Create a file named available with the suffix being the PID
tempfile="/tmp/available.$$"

trap "rm -f $tempfile" EXIT

cat << 'EOF' > $tempfile
    { sum += $4 }
END { mb = sum / 1024
      gb = mb / 1024
      printf "%.0f MB (%.2fGB) of available disk space\n", mb, gb
    }
EOF

df -k | awk -f $tempfile

exit 0
___________________________

My question is is the statement:
cat << 'EOF' > $tempfile

a "here" document?  It sure looks like it. Anyone shed some light on
this for me; thanks.

--
Kind regards,
Jonathan

_______________________________________________
CWE-LUG mailing list
[email protected]
http://www.cwelug.org/
http://www.cwelug.org/archives/
http://www.cwelug.org/mailinglist/

Reply via email to