for loop error
Why the following code shows error ??
Code:
#!/bin/bash Quote:
|
Where is $1 coming from ?
You can't say something is less than or equal to something else, unless the something else (an operand) exists. That's apart from the bad assignment in the loop condition. number=1 |
FYI $[ <arithmetic expression> ] does work but is no longer documented in the man page; the current method is $(( <arithmetic expression> )).
|
In my book, they say it as advanced for loop. Would please give a better link on this ?
|
Quote:
|
The code as you quoted it works IF you supply a number to it.
I repeat - where are you getting $1 from ? You have to supply that number or there is nothing to compare in the for loop condition. try running Code:
test1.sh 15 |
All times are GMT -5. The time now is 05:19 PM. |