Dear all,
I need a script for my students to copy the screenshots they made to their memorystick
and emptying the home-directory for the next student.
I'm not that experienced in scripting but just gave it a try. The problem know is that the user-student hasn't the privilige to mount and unmount
Could anybody give me a hand in solving this problem.
Code:
#!/bin/bash
function mounten {
clear
mount -t vfat /dev/sdb1 /mnt
}
function copy {
clear
cp /user/*.png /mnt
echo "De screenshot zijn gekopieerd en worden van het systeem verwijderd"
rm -f /user/*.png
}
function unmount {
clear
umount /mnt
}
function menu {
clear
echo
echo -e "\t\t\tMenu:\n"
echo -e "\t1. mounten usb-stick"
echo -e "\t2. copy screenshots"
echo -e "\t3. unmounten usb-stick"
echo -e "\t0. exit\n\n"
echo -en "\t\t\tEnter option:"
read -n 1 option
}
while [ 1 ]
do
menu
case $option in
0)
break ;;
1)
mounten ;;
2)
copy ;;
3)
unmount ;;
*)
clear
echo "Sorry, wrong selection";;
esac
echo -en "\n\n\t\tHit any key to continue"
read -n 1 line
done
clear