I tried this,
#!/bin/ksh
for i in {1..10}
do
echo "Welcome $i times"
done
in Ksh of an AIX box.
I am getting the output as,
Welcome {1..10} times
What’s wrong here?
Isn’t it supposed to print from 1 to 10?.
Edit:
According to perkolator’s post, from Iterating through a range of ints in ksh?
It works only on linux. Is there any other work around/replacements for unix box ksh?
for i in 1 2 3 4 5 6 7 8 9 10
is ugly.
Thanks.
I think from memory that the standard
kshon AIX is an older variant. It may not support the ranged for loop. Try to run it withksh93instead ofksh. This should be in the same place asksh, probably/usr/bin.Otherwise, just use something old-school like:
Actually, looking through publib seems to confirm this (the
ksh93snippet) so I’d try to go down that route.