Started övning 4, labb 6

This commit is contained in:
2013-12-19 15:29:29 +01:00
parent 71534704f2
commit b446f85659
7 changed files with 171 additions and 0 deletions

35
Labb6/ovning3.sh Executable file
View File

@@ -0,0 +1,35 @@
#!/bin/bash
# Jack-Benny Persson
# LX13
# Övning 3, labb 6
# Draw a line with a function
# Define variables
Nr=$1
Iterate=0
# Sanity checks
if [ $# -ne 1 ]; then
echo "`basename $0` requires one argument"
exit 2
fi
if ! [ $Nr -eq $Nr &> /dev/null ]; then
echo "Use only integers"
exit 2
fi
# Define our functions
draw()
{
while [ $Iterate -lt $Nr ]; do
printf "*"
((Iterate++))
done
printf "\n"
}
draw
exit 0