Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash
- # simple menu to do various functions
- while [ answer != "0" ]
- do
- clear
- echo "Select from the following functions"
- echo" 0 Blablabla"
- echo" 1 User"
- echo" 2 rasda"
- echo" 3 asdasd"
- echo" 4 exit"
- echo" A Backup E: zipped to G:"
- read -p " ?" answer
- case $answer in
- 0) break ;;
- 1) if [ $(id -u) -eq 0 ]; then
- read -p "Enter username : " username
- read -s -p "Enter password : " password
- egrep "^$username" /etc/passwd >/dev/null
- if [ $? -eq 0 ]; then
- echo "$username exists!"
- exit 1
- else
- pass=$(perl -e 'print crypt($ARGV[0], "password")' $password)
- useradd -m -p $pass $username
- [ $? -eq 0 ] && echo "User has been added to system!" || echo "Failed to add a user!"
- fi
- else
- echo "Only root may add a user to the system"
- exit 2
- fi
- ;;
- 2) rm -rf /disks/D/"System Volume Information"
- rm -rf/disks/E/"System Volume Information"
- rm -rf /disks/F/"System Volume Information"
- rm -rf /disks/G/"System Volume Information"
- ;;
- 3) escputil -q --raw-device=/dev/usb/lp1 -i
- ;;
- 4) break ;;
- A|a) echo "enter zip archive name (eyymmdd)"
- read name
- cd /disks/E/
- zip -r /disks/G/$name.zip *
- cd ~/
- ;;
- *) break ;;
- esac
- echo "press RETURN for menu"
- read key
- done
- exit
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement