[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[ale] Bash vs Perl



On Fri, 21 Oct 2016 20:00:46 -0400
Jim Kinney <jim.kinney at gmail.com> wrote:

> Parsing text in bash is much harder than in Perl. Associative arrays
> in bash really help.

I didn't know bash had associative arrays. Thanks!

=============================
#!/bin/bash

declare -A person
person[fname]="Steve"
person[lname]="Litt"
person[job]="Programmer"

echo ${person["job"]}
=============================

Unfortunately, associative arrays are bash-only: No dash allowed.

SteveT

Steve Litt 
September 2016 featured book: Twenty Eight Tales of Troubleshooting
http://www.troubleshooters.com/28