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?
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 ${#foo[@]} what does the # mean, why it should be in front of foo, and whats @, why it sould be inside []? ive been encountering codes like that and it makes me dizzy.${} is dynamic variable call syntax. # before foo ask for the length of the array foo, [@] returns all items within foo, so we get the actual size of the full array#= length of and @=items and also it only works in ${} i suppose ...noted it, thanks