View Source:
BashHashes
You are viewing an old revision of this page.
View the current version.
bash 4.x has associative arrays (hashes if you are an old perl user like me). The existing examples of how to use them on the internet are kind of garbage. example 1: use a while/read loop to process a file line by line <pre> while read line; do foo=awk blah bar=awk blarg done < file.txt </pre> example 2: same, but process the contents of a multiline variable: <pre> while read line; do foo=awk blah bar=awk blarg done <<< $data </pre> turn those in to hashes, demonstrate how to manipulate them. explain that bang means 'hash key' and no bang means 'hash value'. need to also write up an example of mapfile apologize profusely for doing all this.
Please enable JavaScript to view the
comments powered by Disqus.
HollenbackDotNet
Home Page
Popular Pages
All Categories
Main Categories
General Interest
Geek Stuff
DevOps
Linux Stuff
Pictures
Search
Toolbox
RecentChanges
RecentNewPages
What links here
Printable version
AllPages
RecentChanges
Recent Changes Cached
No changes found
Favorite Categories
ActionPage
(150)
WikiPlugin
(149)
GeekStuff
(137)
PhpWikiAdministration
(102)
Help/PageList
(75)
Help/MagicPhpWikiURLs
(75)
Blog
(69)
Pictures
(60)
GeneralInterest
(44)
LinuxStuff
(38)
Views
View Page
View Source
History
Diff
Sign In