for循环多个变量

for循环多个变量

我有两个文本文件,我想将两个文件的每一行都作为输出,即

#!/bin/bash
u=`cat newlist`
for i in $u 
do
echo ""
echo ",'$i'"

for b in $( cat password )
do
echo ",'$b'"
done
done

输出应该是

abc - from Users file 'line # 1'
123 - from password file 'line # 1'

请帮忙

答案1

#!/bin/bash
exec 8<passwordfile
while read user
do
    read password <&8
    echo $user
    echo $password
done <usersfile

答案2

相关内容