Re: [SLUG] Scripting question

From: Ronan Heffernan (ronan@iotcorp.com)
Date: Thu Sep 05 2002 - 17:02:14 EDT


Joe O wrote:
>
> On 5 Sep 2002, Ian C. Blenke wrote:
>
>
>>On Thu, 2002-09-05 at 15:04, Smitty wrote:
>>
>> #!/bin/sh
>> LIMIT=10
>> for((n=1; n <= LIMIT ; n++)) ; do
>> command
>> done
>>
>>Yes, you actually can use C-like syntax within double-parenthesis.
>
>
> That is bash specific. Won't work on other platforms with a more
> traditional bourne shell implementation.
>

If portability is a concern, I would go with Python. It works the same
way regardless of the shell (even non-Bourne shells). It even works on
Windows!

import os
for i in range(0,5):
    os.system("echo hello world")
os.system("echo run some other command")



This archive was generated by hypermail 2.1.3 : Fri Aug 01 2014 - 18:57:48 EDT