Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
11
Task/Hash-from-two-arrays/UNIX-Shell/hash-from-two-arrays.sh
Normal file
11
Task/Hash-from-two-arrays/UNIX-Shell/hash-from-two-arrays.sh
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
keys=( foo bar baz )
|
||||
values=( 123 456 789 )
|
||||
declare -A hash
|
||||
|
||||
for (( i = 0; i < ${#keys[@]}; i++ )); do
|
||||
hash["${keys[i]}"]=${values[i]}
|
||||
done
|
||||
|
||||
for key in "${!hash[@]}"; do
|
||||
printf "%s => %s\n" "$key" "${hash[$key]}"
|
||||
done
|
||||
Loading…
Add table
Add a link
Reference in a new issue