May 16, 2003 #1 byuen Programmer Joined May 14, 2003 Messages 6 Location US for a korn shell, what is the equivalent c++ command for: (for int i = 0; i < 20; i++) ? thanks,
May 16, 2003 #2 gamerland Programmer Joined Apr 6, 2003 Messages 53 Location US Yes, but I do not think it is what you wish. Here is a good Korn shell overview site: http://www.vis.ethz.ch/manuals/Unixkurs/ksh.html#looping for foo in $(ls);do if [[ -d $foo ]];then print "$foo is a directory" else print "$foo is not a directory" fi done But, if you need a counter then do this: count=99 while [[ $count -gt 0 ]];do print "\$count is $count" (( count -= 1 )) done Upvote 0 Downvote
Yes, but I do not think it is what you wish. Here is a good Korn shell overview site: http://www.vis.ethz.ch/manuals/Unixkurs/ksh.html#looping for foo in $(ls);do if [[ -d $foo ]];then print "$foo is a directory" else print "$foo is not a directory" fi done But, if you need a counter then do this: count=99 while [[ $count -gt 0 ]];do print "\$count is $count" (( count -= 1 )) done
May 16, 2003 #3 SamBones Programmer Joined Aug 8, 2002 Messages 3,186 Location US This works... Code: #!/bin/ksh CTR=21 # Needs to be one more than the number of times you want while (( CTR -= 1 )) do print "Counter CTR is ${CTR}" done Of course this starts at 20 and counts down, but it does give you a loop that executes just that many times. Hope this helps. Upvote 0 Downvote
This works... Code: #!/bin/ksh CTR=21 # Needs to be one more than the number of times you want while (( CTR -= 1 )) do print "Counter CTR is ${CTR}" done Of course this starts at 20 and counts down, but it does give you a loop that executes just that many times. Hope this helps.
May 17, 2003 #4 AIXSPadmin MIS Joined May 3, 2002 Messages 633 Location US ksh93 allows the use of (i=0; i < 10; i++) functionality. Upvote 0 Downvote