Debian Codegraph @

ex17.sh

raw symbols SCIP
1 #!/bin/bash
2
3 # Call this script with at least 10 parameters, for example
4 # ./scriptname 1 2 3 4 5 6 7 8 9 10
5 MINPARAMS=10
6
7 echo
8
9 echo "The name of this script is \"$0\"."
10 # Adds ./ for current directory
11 echo "The name of this script is \"`basename $0`\"."
12 # Strips out path name info (see 'basename')
13
14 echo
15
16 if [ -n "$1" ] # Tested variable is quoted.
17 then
18 echo "Parameter #1 is $1" # Need quotes to escape #
19 fi
20
21 if [ -n "$2" ]
22 then
23 echo "Parameter #2 is $2"
24 fi
25
26 if [ -n "$3" ]
27 then
28 echo "Parameter #3 is $3"
29 fi
30
31 # ...
32
33
34 if [ -n "${10}" ] # Parameters > $9 must be enclosed in {brackets}.
35 then
36 echo "Parameter #10 is ${10}"
37 fi
38
39 echo "-----------------------------------"
40 echo "All the command-line parameters are: "$*""
41
42 if [ $# -lt "$MINPARAMS" ]
43 then
44 echo
45 echo "This script needs at least $MINPARAMS command-line arguments!"
46 fi
47
48 echo
49
50 exit 0