Skip to content

Instantly share code, notes, and snippets.

@andres-fr
Created February 8, 2018 11:23
Show Gist options
  • Select an option

  • Save andres-fr/5c3472148a3e348f3b9dff3ff5bf6ad5 to your computer and use it in GitHub Desktop.

Select an option

Save andres-fr/5c3472148a3e348f3b9dff3ff5bf6ad5 to your computer and use it in GitHub Desktop.
A simple example of defining and iterating over a hash map in bash4
declare -A table=(["2017_10_10_06_35_48"]="1507653643855 1507653618853 1507653549538 1507653656449 1507653643683 1507653657262" ["2017_10_10_04_08_29"]="1507644652041 1507644656963 1507644746592 1507644767765 1507644803720 1507645191645 1507645193645" ["2017_09_14_12_10_46_Anita"]="1505384055344 1505384056438 1505384060281 1505384062750 1505384067126 1505384067313 1505384072126 1505384073001 1505384073376 1505384074032 1505384074157 1505384074626 1505384198554 1505384226587 1505384228774 1505384257776 1505384260854 1505384260979 1505384267432" ["2017_09_14_12_19_08_Nida_aufs_Dach"]="1505384352176 1505384352333 1505384352489 1505384365130 1505384376787 1505384397522 1505384397710 1505384398304 1505384401147 1505384405273" ["2017_10_25_02_08_30"]="1508933312919 1508933312966 1508933313013 1508933313075 1508933313200 1508933313263 1508934104162 1508934104209 1508934104272 1508934104334 1508934104397 1508934104459 1508934105444 1508934105490 1508934105553 1508934105615 1508934105678 1508934312548" ["2017_09_14_11_39_18_SreenivasMurali"]="1505382116318 1505382115803" ["2017_09_14_12_20_44"]="1505384797392 1505384699918 1505384502908" ["2017_09_25_03_49_35"]="1506347534808 1506347535058 1506347550747 1506347553309 1506347718475 1506347945017 1506347947642 1506347953315" ["2017_09_13_01_46_37"]="1505303415817" ["2017_08_14_03_04_51"]="1502716093338 1502716097311 1502716190458 1502716190578 1502716190632 1502716190686 1502716191064 1502716191527 1502716192085" ["2017_10_10_01_17_32"]="1507634338408 1507634340502 1507634341065 1507634341221 1507634363410 1507634371160 1507634386301 1507634387879 1507634683956 1507634984783 1507635043348 1507635071568 1507635198512 1507635332456" ["2017_08_14_02_56_09"]="1502715373001 1502715486841 1502715486887 1502715486937 1502715486992 1502715581041 1502715581163 1502715588317 1502715588641 1502715588778 1502715588836 1502715596261 1502715596307 1502715596562 1502715596793 1502715596858 1502715596913 1502715597240 1502715597535 1502715597614 1502715599167 1502715599947 1502715600842 1502715601909 1502715602415 1502715602525 1502715603095" ["2017_10_27_10_45_04"]="1509137371694 1509137371741 1509137371882 1509137372038 1509137372179 1509137373350 1509137462980 1509137562626 1509137646614 1509137646833 1509137654380 1509137654443 1509137661428 1509137688554 1509137688616 1509137688679 1509137688804 1509137688866 1509137688960 1509137689523" ["2017_10_12_03_55_13"]="1507817031180" ["2017_10_19_04_35_27"]="1508423755789 1508423762664 1508423763789 1508423763898 1508423763961 1508423764180 1508423764836 1508423765711 1508423766586" ["2017_10_10_03_54_11"]="1507643891765 1507643856919")
for i in ${!table[@]}; do for j in ${table[$i]}; do echo $i $j; done; done;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment