Is there a way to implement the following using \'for\' in KornShell (ksh)? Here is the C equivalent:
for(i=1;i<20;i++)
{
printf(\"%d\",i);
}
<
ksh93 supports the C-like (( ...;...; ...)):
for ((i=1;i<20;i+=1)); do
printf "%d " $i
done && print
This will produce:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
Heck, even the old syntax (using '{' ... '}' instead of 'do ... done' will work):
for((i=1;i<20;i+=1))
{
printf "%d " $i
} && print
In older shells, you can still get the same effect with
i=1 && while ((i<20)); do
printf "%d " $i
((i+=1))
done && print