| 1 | #!/bin/bashscip-shell filesystem . . `/bin/bash`. |
| 2 | # Functions and parameters |
| 3 | |
| 4 | DEFAULT=default # Default param value. |
| 5 | |
| 6 | func2scip-shell shell abs-guide 10-4 func2(). () { |
| 7 | if [scip-shell system . . `[`. -z "$1" ] # Is parameter #1 zero length? |
| 8 | then |
| 9 | echoscip-shell system . . echo. "-Parameter #1 is zero length.-" # Or no parameter passed. |
| 10 | else |
| 11 | echoscip-shell system . . echo. "-Parameter #1 is \"$1\".-" |
| 12 | fi |
| 13 | |
| 14 | variable=${1-$DEFAULT} # What does |
| 15 | echoscip-shell system . . echo. "variable = $variable" #+ parameter substitution show? |
| 16 | # --------------------------- |
| 17 | # It distinguishes between |
| 18 | #+ no param and a null param. |
| 19 | |
| 20 | if [scip-shell system . . `[`. "$2" ] |
| 21 | then |
| 22 | echoscip-shell system . . echo. "-Parameter #2 is \"$2\".-" |
| 23 | fi |
| 24 | |
| 25 | return 0 |
| 26 | } |
| 27 | |
| 28 | echoscip-shell system . . echo. |
| 29 | |
| 30 | echoscip-shell system . . echo. "Nothing passed." |
| 31 | func2scip-shell shell abs-guide 10-4 func2(). # Called with no params |
| 32 | echoscip-shell system . . echo. |
| 33 | |
| 34 | |
| 35 | echoscip-shell system . . echo. "Zero-length parameter passed." |
| 36 | func2scip-shell shell abs-guide 10-4 func2(). "" # Called with zero-length param |
| 37 | echoscip-shell system . . echo. |
| 38 | |
| 39 | echoscip-shell system . . echo. "Null parameter passed." |
| 40 | func2scip-shell shell abs-guide 10-4 func2(). "$uninitialized_param" # Called with uninitialized param |
| 41 | echoscip-shell system . . echo. |
| 42 | |
| 43 | echoscip-shell system . . echo. "One parameter passed." |
| 44 | func2scip-shell shell abs-guide 10-4 func2(). first # Called with one param |
| 45 | echoscip-shell system . . echo. |
| 46 | |
| 47 | echoscip-shell system . . echo. "Two parameters passed." |
| 48 | func2scip-shell shell abs-guide 10-4 func2(). first second # Called with two params |
| 49 | echoscip-shell system . . echo. |
| 50 | |
| 51 | echoscip-shell system . . echo. "\"\" \"second\" passed." |
| 52 | func2scip-shell shell abs-guide 10-4 func2(). "" second # Called with zero-length first parameter |
| 53 | echoscip-shell system . . echo. # and ASCII string as a second one. |
| 54 | |
| 55 | exit 0 |