| 1 | #!/bin/bash4scip-shell filesystem . . `/bin/bash4`. |
| 2 | # fetch_address.sh |
| 3 | |
| 4 | declare -A address |
| 5 | # -A option declares associative array. |
| 6 | |
| 7 | address[Charles]="414 W. 10th Ave., Baltimore, MD 21236" |
| 8 | address[John]="202 E. 3rd St., New York, NY 10009" |
| 9 | address[Wilma]="1854 Vermont Ave, Los Angeles, CA 90023" |
| 10 | |
| 11 | |
| 12 | echoscip-shell system . . echo. "Charles's address is ${address[Charles]}." |
| 13 | # Charles's address is 414 W. 10th Ave., Baltimore, MD 21236. |
| 14 | echoscip-shell system . . echo. "Wilma's address is ${address[Wilma]}." |
| 15 | # Wilma's address is 1854 Vermont Ave, Los Angeles, CA 90023. |
| 16 | echoscip-shell system . . echo. "John's address is ${address[John]}." |
| 17 | # John's address is 202 E. 3rd St., New York, NY 10009. |
| 18 | |
| 19 | echoscip-shell system . . echo. |
| 20 | |
| 21 | echoscip-shell system . . echo. "${!address[*]}" # The array indices ... |
| 22 | # Charles John Wilma |