-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmultitool.sh
65 lines (61 loc) · 1.25 KB
/
multitool.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
#!/bin/bash
echo "------------------------------"
echo "Multitool version 2"
echo "Please, select a function:"
echo "[1] Create user"
echo "[2] Delete user"
echo "[3] Download a file with wget"
echo "[4] Output all processes on host"
echo "------------------------------"
echo "[0] Exit"
while [ 1 ]
do
echo -n "->"
read choice
case $choice in
1)
echo "------------------------------"
while [[ -z "$newusername" ]]; do
read -p "Enter a username for new user: " newusername
done
read -s -p "Enter a password for new user: " password
useradd -m $newusername
echo "$newusername:$password" | chpasswd
newusername=""
echo
echo "------------------------------"
;;
2)
echo "------------------------------"
while [[ -z "$delusername" ]]; do
read -p "Enter username (del): " delusername
done
userdel -r $delusername
delusername=""
echo "------------------------------"
;;
3)
echo "------------------------------"
read -p "Enter a URL for downloading file: " file_url
if [[ -z "$file_url" ]]; then
echo "URL is empty! Please input number 3 and try again!"
else
wget $file_url
file_url=""
echo "------------------------------"
fi
;;
4)
echo "------------------------------"
ps axu
echo "------------------------------"
;;
0)
echo "Good bye!"
break
;;
*)
echo "Invalid option!"
;;
esac
done