Debian Codegraph @

ex71b.sh

raw symbols SCIP
1 #!/bin/bash
2 # Another 'cat' here document, using parameter substitution.
3
4 # Try it with no command-line parameters, ./scriptname
5 # Try it with one command-line parameter, ./scriptname Mortimer
6 # Try it with one two-word quoted command-line parameter,
7 # ./scriptname "Mortimer Jones"
8
9 CMDLINEPARAM=1 # Expect at least command-line parameter.
10
11 if [ $# -ge $CMDLINEPARAM ]
12 then
13 NAME=$1 # If more than one command-line param,
14 #+ then just take the first.
15 else
16 NAME="John Doe" # Default, if no command-line parameter.
17 fi
18
19 RESPONDENT="the author of this fine script"
20
21
22 cat <<Endofmessage
23
24 Hello, there, $NAME.
25 Greetings to you, $NAME, from $RESPONDENT.
26
27 # This comment shows up in the output (why?).
28
29 Endofmessage
30
31 # Note that the blank lines show up in the output.
32 # So does the comment.
33
34 exit