Test select and completed Övning 5, labb 4

This commit is contained in:
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