| 1 | #!/bin/bashscip-shell filesystem . . `/bin/bash`. |
| 2 | # "Reading" variables. |
| 3 | |
| 4 | echoscip-shell system . . echo. -n "Enter the value of variable 'var1': " |
| 5 | # The -n option to echo suppresses newline. |
| 6 | |
| 7 | read var1 |
| 8 | # Note no '$' in front of var1, since it is being set. |
| 9 | |
| 10 | echoscip-shell system . . echo. "var1 = $var1" |
| 11 | |
| 12 | |
| 13 | echoscip-shell system . . echo. |
| 14 | |
| 15 | # A single 'read' statement can set multiple variables. |
| 16 | echoscip-shell system . . echo. -n "Enter the values of variables 'var2' and 'var3' " |
| 17 | echoscip-shell system . . echo. =n "(separated by a space or tab): " |
| 18 | read var2 var3 |
| 19 | echoscip-shell system . . echo. "var2 = $var2 var3 = $var3" |
| 20 | # If you input only one value, |
| 21 | #+ the other variable(s) will remain unset (null). |
| 22 | |
| 23 | exit 0 |