shell-whiz-toolkit/shell_scripts/lessons/arguments.ssh
2014-07-01 19:51:31 -04:00

15 lines
No EOL
313 B
Bash
Executable file

#! /bin/bash
# script to test for loop and arguments
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
for i in 1 2 3 4 5 6 7 8 9 10
do
echo "$n * $i = `expr $i \* $n`"
done