2 ms·
Modern Bash (a.k.a. the bash you get with Linux but not with OS X) even has associative arrays similar to what you would call a dict in Python or a hash in Perl
by minimax 13y ago
Modern Bash (a.k.a. the bash you get with Linux but not with OS X) even has associative arrays similar to what you would call a dict in Python or a hash in Perl.
$ declare -A capitals
$ capitals["Illinois"]="Springfield"
$ capitals["California"]="Sacramento"
$ echo ${capitals["California"]}
Sacramento
$ echo ${capitals["Illinois"]}
Springfield
$ for k in ${!capitals[@]} ; do
> echo "The capital of $k is ${capitals[$k]}"
> done
The capital of Illinois is Springfield
The capital of California is Sacramento
- gislifb 13y agoNice, never knew about this. Cheers