Loops in UNIX Shell Scripts - until Statement
The until construct allows iterations through a block of script as long as a certain condition is false.
Syntax:
until condition
do
commands
done
Example:
The example script counts up to 10 secs.
#!/bin/sh
i=1
until [ $i -gt 10 ];
do
sleep 1
print "$i"
i=` expr $i + 1 `
done
exit 0
Syntax:
until condition
do
commands
done
Example:
The example script counts up to 10 secs.
#!/bin/sh
i=1
until [ $i -gt 10 ];
do
sleep 1
print "$i"
i=` expr $i + 1 `
done
exit 0
Comments
Post a Comment