Reputation: 329
example:
for i in 1 2 3 4, j in 7 8 9 0
do
echo $i"="$j
done
output:
1=7
2=8
3=9
4=0
i know this code will throw you a lot of error right away, but is there any way?
Upvotes: 0
Views: 28
Reputation: 10403
There is no such thing in Bash, but you can get your desired output:
foo=(1 2 3 4)
bar=(7 8 9 0)
for (( i=0; i<${#foo[@]}; i++ ))
do
echo "${foo[$i]}=${bar[$i]}"
done
Upvotes: 2