| 1 | #!/bin/bashscip-shell filesystem . . `/bin/bash`. |
| 2 | # Planets revisited. |
| 3 | |
| 4 | # Associate the name of each planet with its distance from the sun. |
| 5 | |
| 6 | for planet in "Mercury 36" "Venus 67" "Earth 93" "Mars 142" "Jupiter 483" |
| 7 | do |
| 8 | set -- $planet # Parses variable "planet" |
| 9 | #+ and sets positional parameters. |
| 10 | # The "--" prevents nasty surprises if $planet is null or |
| 11 | #+ begins with a dash. |
| 12 | |
| 13 | # May need to save original positional parameters, |
| 14 | #+ since they get overwritten. |
| 15 | # One way of doing this is to use an array, |
| 16 | # original_params=("$@") |
| 17 | |
| 18 | echoscip-shell system . . echo. "$1 $2,000,000 miles from the sun" |
| 19 | #-------two tabs---concatenate zeroes onto parameter $2 |
| 20 | done |
| 21 | |
| 22 | # (Thanks, S.C., for additional clarification.) |
| 23 | |
| 24 | exit 0 |