[ale] Bash vs Perl

Jim Kinney jim.kinney at gmail.com
Tue Oct 25 11:03:24 EDT 2016


On Oct 25, 2016 10:54 AM, "Steve Litt" <slitt at troubleshooters.com> wrote:
>
> 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.
>

Use a  single quote around the content string and even spaces, ., and /\
are allowed.
> SteveT
>
> Steve Litt
> September 2016 featured book: Twenty Eight Tales of Troubleshooting
> http://www.troubleshooters.com/28
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.ale.org/pipermail/ale/attachments/20161025/c368ea74/attachment.html>


More information about the Ale mailing list