Skip to content

Instantly share code, notes, and snippets.

@m3nd3s
Created April 28, 2012 00:03
Show Gist options
  • Save m3nd3s/2514437 to your computer and use it in GitHub Desktop.
Save m3nd3s/2514437 to your computer and use it in GitHub Desktop.
While example
$cat > nt1
#!/bin/sh
#
#Script to test while statement
#
#
if [ $# -eq 0 ]
then
echo "Error - Number missing form command line argument"
echo "Syntax : $0 number"
echo " Use to print multiplication table for given number"
exit 1
fi
n=$1
i=1
while [ $i -le 10 ]
do
echo "$n * $i = `expr $i \* $n`"
i=`expr $i + 1`
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment