bash 쉘 while 루프가 조건식을 초과함

bash 쉘 while 루프가 조건식을 초과함

j내 질문에는 value 및 ivaluereach 처럼 보입니다 . 6누구 i든지 5설명할 수 있습니까?

i=0;
j=0;
echo "values of $i and $j" > debug.txt;
while [ $j -le 5 ]
do
    j=expr $j + 1
    i=expr $i + 1
    echo "values of $i and $j" >> debug.txt
done;
cat debug.txt;

산출:

value of i is  0 and j is  0
value of i is  1 and j is  1
value of i is  2 and j is  2
value of i is  3 and j is  3
value of i is  4 and j is  4
value of i is  5 and j is  5
value of i is  6 and j is  6

답변1

스크립트가 작동하지 않는 이유는 -le. -le으로 변경됩니다 -lt.

관련 정보