Test select and completed Övning 5, labb 4

This commit is contained in:
Jack-Benny Persson 2013-12-16 15:59:41 +01:00
parent 213a227166
commit 04b076b790
2 changed files with 34 additions and 4 deletions

View File

@ -5,18 +5,20 @@
# Övning 5, labb 5
# Backup-script
# Sanity checks
# Set some variabels
BackupTo="$HOME/backups/"
# Set our binarys
Tar="/bin/tar"
# Sanity checks
if [ $# -ne 1 ]; then
echo "Usage: $0 <directory>"
exit 2
fi
if [ -w $BackupTo ]; then
echo "Can't write to $BackupTo" > /dev/stderr
if [ ! -w $BackupTo ] || [ ! -d $BackupTo ]; then
echo "Can't write to $BackupTo or doesn't exist" > /dev/stderr
exit 2
fi
@ -26,4 +28,6 @@ if [ ! -r "$1" ]; then
fi
# Main
$Tar cvf ${BackupTo}`basename $1`.tar $1
exit 0

26
Misc/test_select.sh Executable file
View File

@ -0,0 +1,26 @@
#!/bin/bash
# Jack-Benny Persson
# LX13
# Testing select, thx Paulena :)
select Word in "Ja" "Nej" "Kanske" "Exit"; do
echo $Word
case "$Word" in
Ja)
echo "Omg YES"
;;
Nej)
echo "Oh no"
;;
Kanske)
echo "Maybe later baby"
;;
Exit)
echo "Se ya later"
exit 0
;;
esac
done
exit 0