On 12/11/2010 09:34 AM, S Mathias wrote:
> but what's the "magic" for this? :
>
> $ MAGIC; do echo "Welcome $i times"; done
> Welcome 0 times
> Welcome 1 times
> Welcome 4 times
> Welcome 5 times
> Welcome 8 times
> Welcome 9 times
> $
>
> thanks:\
>
>
Probably lots of ways to do this here's one:
WeirdIncr () {
typeset -i j
typeset -i z
j=$1
z=$(expr $j % 2)
if (( z == 0 )) ; then
j="j+1"
else
j="j+3"
fi
echo $j
}
typeset -i i
let i=0
while (( i < 10 ))
do
echo "Hi $i"
i=$(WeirdIncr $i)
done
--
users mailing list
[email protected]
To unsubscribe or change subscription options:
https://admin.fedoraproject.org/mailman/listinfo/users
Guidelines: http://fedoraproject.org/wiki/Mailing_list_guidelines