![]() |
|
|
|
|
|||||||
| Forums | Portal | Register | Forum Rules | FAQ | Contribute | Members List | Arcade | Search | Today's Posts | Mark Forums Read |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts here. |
|
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Increment date in 'for' loop? | SunnyK | Shell Programming and Scripting | 4 | 10-30-2007 03:12 AM |
| Infinite Loop in Autosys while running a shell script, Manual run is fine | sharmagaurav_2k | Shell Programming and Scripting | 2 | 09-04-2007 05:20 AM |
| pick the bug the server enters an infinite loop | arjunjag | High Level Programming | 3 | 07-18-2007 10:53 PM |
| ls command in infinite Loop | umakant | SUN Solaris | 3 | 07-16-2007 10:25 PM |
| high priority thread contains an infinite loop | rvan | High Level Programming | 0 | 02-14-2007 06:30 AM |
|
|
Submit Tools | LinkBack | Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
code is as
#!/bin/sh i=1; while [ $i -le 5] do welcome $i times; i='expr $i+1'; done exit 0; |
| Forum Sponsor | ||
|
|
|
#2
|
|||
|
|||
|
A space between the 5 and ] might make a difference.
|
|
#3
|
|||
|
|||
|
Quote:
Code:
#!/bin/sh i=1 while [ $i -le 5 ] do welcome $i times; echo "value of i is...$i" i='expr $i + 1' done exit 0 |
|
#4
|
|||
|
|||
|
after doing all the above steps its not worki9ng can anyone suggest another workable way of incrementing the variable i
|
|
#5
|
|||
|
|||
|
Please try to do it. I think it will increament the value of i.
#!/bin/sh i=0 while [ $i -le 5 ] do echo "value of i is...$i" i=`expr $i + 1` done |
|
#6
|
|||
|
|||
|
thanks its working
|
|
#7
|
|||
|
|||
|
wrong format
HI,
There are two typos for you i think. First, 5 ] not 5] Second, ` not ' Code:
i=1; while [ $i -le 5 ] do echo "welcome $i times" i=`expr $i + 1` done |
|||
| Google The UNIX and Linux Forums |