[ale] Bash vs Perl

Steve Litt slitt at troubleshooters.com
Tue Oct 25 10:54:15 EDT 2016


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




More information about the Ale mailing list