我有 bash 脚本(1.sh),它在 while 循环内调用(2.sh)。仅一次迭代后执行就会停止。如果我删除对 2.sh 的调用,它会完美执行
我的代码1.sh
while read -a A ; do
echo "${GREEN} Making production build for ${A[0]} ${NC}"
# run build for each component
./2.sh ${A[0]} ${A[1]}
if [[ $? -eq 1 ]]; then
# create logs of error builds
ERRORBUILDS+=${A[0]}" ,"
fi
done < $1
答案1
./2.sh < /dev/null ${A[0]} ${A[1]}