![]() |
|
|
|
|
|||||||
| Forums | Portal | Register | 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 |
| Alternative for a while read line loop | kabs | UNIX for Dummies Questions & Answers | 2 | 04-01-2008 09:25 AM |
| Using awk (or an alternative) | michaeltravisuk | Shell Programming and Scripting | 5 | 03-08-2007 07:37 PM |
| .NET Alternative | goon12 | UNIX for Dummies Questions & Answers | 3 | 04-06-2005 09:07 AM |
| cut -f (or awk alternative) | gefa | Shell Programming and Scripting | 6 | 03-02-2005 09:26 AM |
| loop alternative? | apalex | Shell Programming and Scripting | 2 | 05-02-2002 09:47 AM |
|
|
LinkBack | Thread Tools | Display Modes |
|
|||
|
help with while loop or any other alternative?
Code:
i=1
while [ $i -le $1 ]
do
mm=02
dd=03
yy=2008
echo "$mm$dd$yy"
i=$(( i+1))
echo "$i"
done
syntax error at line 30: `i=$' unexpected could anyone kindly tell me what is wrong with the above script or is there any other alternative loop that i can use ? can i use a 'for loop' ? |
| Forum Sponsor | ||
|
|
|
|||
|
Which shell are you running this under? The $((...)) construct is not understood by /bin/sh
If you need this to work in Bourne shell, the classical syntax for incrementing a variable is Code:
i=`expr $i + 1` |