until 문을 이용해서 400씩 증가시키는 쉘 스크립트
1 2 3 4 5 6 7 8 9 10 11 12 13 14 |
#!/bin/bash A="1" MAX="2500" C="1" until [ $A -gt $MAX ] do B=`expr $A + 399` echo "Start $A EDN=$B / COUNT=$C" A=$(($A+400)) C=$(($C+1)) done |
결과값
1 2 3 4 5 6 7 8 |
[root@xinet /shell/ ]# sh until.sh Start 1 EDN=400 / COUNT=1 Start 401 EDN=800 / COUNT=2 Start 801 EDN=1200 / COUNT=3 Start 1201 EDN=1600 / COUNT=4 Start 1601 EDN=2000 / COUNT=5 Start 2001 EDN=2400 / COUNT=6 Start 2401 EDN=2800 / COUNT=7 |