![]() |
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | 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 and shell scripting languages here. |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Problem in For Loop | The Observer | Shell Programming and Scripting | 2 | 05-28-2008 02:43 AM |
| for loop problem | namishtiwari | Shell Programming and Scripting | 5 | 01-25-2008 12:58 PM |
| loop problem | maskot | Shell Programming and Scripting | 1 | 05-25-2007 04:10 AM |
| Problem with for loop/sed ? | chiru_h | Shell Programming and Scripting | 2 | 08-27-2006 11:55 AM |
| problem with while loop | mridula | High Level Programming | 1 | 12-11-2005 11:44 AM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
||||
|
Quote:
Hi, Your problem is that you are not running any loop ....., you just set the string [1..9] into i and print it to the screen, For what you want to do u need the following: for (( i = 0 ; i <= 9; i++ )) do echo $i done |
|
||||
|
Short explaination
When you use:
for x in 1 2 3 4 It takes the first param and set it to x, after that it runs into 2nd param and so on till it finish read all params. At yours case u wrote for i in [1..9] - it act like [1..9] is the first param so it set the whole string into i, and since there is nothing after [1..9] it finish the loop after one run. in case u insist to ust the "for i in ...." format you must enter the values like that: 1 2 3 4 5 6 7 8 9 or to create a list file containing all the params u want to run and than u can write: for i in $file |
| Sponsored Links | ||
|
|
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|