Hi, I have question about the following script. If I define the variable in the script, then the output came out correct. My question is if I passing FOO and BAR as args through script, then the output is wrong.
How can I passing correct through args through script?
thanks!
#!/bin/sh
#FOO=( bar string 'some text' )
#BAR=( foo string 'other text' )
FOO=( $1 )
BAR=( $2 )
foonum=${#FOO}
for ((i=0;i<$foonum;i++)); do
echo ${FOO[${i}]} ${BAR[${i}]}
done
How can I passing correct through args through script?
thanks!
#!/bin/sh
#FOO=( bar string 'some text' )
#BAR=( foo string 'other text' )
FOO=( $1 )
BAR=( $2 )
foonum=${#FOO}
for ((i=0;i<$foonum;i++)); do
echo ${FOO[${i}]} ${BAR[${i}]}
done