Skip to content

Commit eaadb77

Browse files
authored
Add files via upload
1 parent 680c5fd commit eaadb77

File tree

1 file changed

+54
-0
lines changed

1 file changed

+54
-0
lines changed
Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
#!/bin/bash
2+
3+
# Function to display a menu
4+
show_menu() {
5+
echo "============================="
6+
echo " Shell Scripting Utility"
7+
echo "============================="
8+
echo "1. Backup Files"
9+
echo "2. Update System"
10+
echo "3. Backup and Update"
11+
echo "4. Exit"
12+
echo -n "Choose an option [1-4]: "
13+
}
14+
15+
# Function to perform a backup
16+
backup_files() {
17+
echo "Starting backup..."
18+
BACKUP_DIR="$HOME/backup_$(date +%Y%m%d_%H%M%S)"
19+
mkdir -p "$BACKUP_DIR"
20+
cp -r $HOME/Documents $HOME/Pictures $HOME/Videos "$BACKUP_DIR"
21+
echo "Backup completed. Files saved to $BACKUP_DIR"
22+
}
23+
24+
# Function to update the system
25+
update_system() {
26+
echo "Updating system..."
27+
sudo apt update && sudo apt upgrade -y
28+
echo "System update completed."
29+
}
30+
31+
# Main program loop
32+
while true; do
33+
show_menu
34+
read -r choice
35+
case $choice in
36+
1)
37+
backup_files
38+
;;
39+
2)
40+
update_system
41+
;;
42+
3)
43+
backup_files
44+
update_system
45+
;;
46+
4)
47+
echo "Exiting. Goodbye!"
48+
break
49+
;;
50+
*)
51+
echo "Invalid choice, please try again."
52+
;;
53+
esac
54+
done

0 commit comments

Comments
 (0)