Well hmm. Bash supports arrays, but I don't believe it supports dictionaries directly.<br>
<br>
That said, with unlimited time and money anything is possible. I've done stuff like this when necessary with for loops..<br>
<br>
#!/bin/bash<br>
<br>
nv_pairs="one_1 two_2 three_3 four_4"<br>
<br>
get_name_for_value () {<br>
for kk in $nv_pairs<br>
do<br>
name=`echo $kk | awk -F_ '{print $1}'`<br>
if [ $name == $1 ]<br>
then<br>
value=`echo $kk | awk -F_ '{print $2}'`<br>
fi<br>
done<br>
echo $value<br>
}<br>
<br>
Name=three<br>
val=`get_name_for_value $Name`<br>
echo Name: $Name Value: $val<br>
<br>
<br><div><span class="gmail_quote">On 3/31/08, <b class="gmail_sendername">Jerry Yu</b> <<a href="mailto:jjj863@gmail.com">jjj863@gmail.com</a>> wrote:</span><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
I need to do named has in bash scripting, the equivalent in perl, "my $hash{$key} = $value;". Can I?<br>
<br>_______________________________________________<br>
Ale mailing list<br>
<a onclick="return top.js.OpenExtLink(window,event,this)" href="mailto:Ale@ale.org">Ale@ale.org</a><br>
<a onclick="return top.js.OpenExtLink(window,event,this)" href="http://mail.ale.org/mailman/listinfo/ale" target="_blank">http://mail.ale.org/mailman/listinfo/ale</a><br>
<br></blockquote></div><br>