Labb 3 klar, bara reflektionen kvar att skriva

This commit is contained in:
2013-12-11 15:29:40 +01:00
parent f766cb61d9
commit 179e1ce823
2 changed files with 42 additions and 0 deletions

32
Labb3/ovning4.sh Executable file
View File

@@ -0,0 +1,32 @@
#!/bin/bash
# Jack-Benny Persson
# LX13
# Öving 4, labb 3
Arg=$1
# Sanity checks
if [ $# -ne 1 ]; then
echo "Enter a filename as an argument, such as $0 <filename.txt>"
exit 1
fi
if [ ! -e $Arg ]; then
echo "$Arg does not exist"
exit 2
fi
# Check whatever arg1 is a block device, directory or a regular file
if [ -b $Arg ]; then
echo "$Arg is a block device"
elif [ -d $Arg ]; then
echo "$Arg is a directory"
elif [ -f $Arg ]; then
echo "$Arg is regular file"
else
echo "$Arg is something else"
fi
exit 0