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