|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
Stay one step ahead of the competition. Evaluate and give feedback
on some of the hottest web development tools on the market today.
Make your opinion heard! Click
Here
|
|
#1
|
|||
|
|||
|
Hi,
I very need to write a loop ( containt while or until or for ) that can count in ScoUnixOpenserver shell script (bash shell) . I try to write a loop like follow but don't work correctly : ---------------------------------------------------------------- #!/bin/bash clear no=1 while test $no -le 100 do no=expr $no + 1 echo $no done ---------------------------------------------------------------- enyone can help me . thank you for your note. F.H. |
|
#2
|
|||
|
|||
|
See below for solution. Note the use of backquotes
to evaluate the expression. Also the echo command needs to be before the count increment - otherwise the numbers 2 to 101 are output. no=1 while test $no -le 100 do echo $no no=`expr $no + 1` done - Finnbarr |
![]() |
| Viewing: Dev Shed Forums > Operating Systems > UNIX Help > Help me to write a loop counter |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|