📌 What We’ll Cover
✨ Project 1: Create a Backup of a Folder
✨ Project 2: Make a Simple To-Do List Script
✨ Project 3: Check Disk Space and Warn if Full
Each example starts as a question/task, so you can think about how you'd solve it — and then I’ll show the solution.
💡 Project 1: Create a Backup of a Folder
📝 The task:
Write a script that asks the user for a folder name, then copies that folder to a new location with "_backup" added to its name.
💡 Project 2: Make a Simple To-Do List Script
📝 The task:
Write a script that lets the user add a new task to a text file called todo.txt. After adding, it should display all tasks so far.
💡 Project 3: Check Disk Space and Warn if Full
📝 The task:
Write a script that checks the disk space on your system. If disk usage is more than 80%, show a warning message
✅ Solutions
🌟 Project 1: Create a Backup of a Folder
#!/bin/bash
echo "Enter the folder name to back up:"
read folder
if [ -d "$folder" ]; then
cp -r "$folder" "${folder}_backup"
echo "Backup created: ${folder}_backup"
else
echo "Folder does not exist!"
fi
✅ Backup Script Example Output
Enter the folder name to back up:
myfolder
Backup created: myfolder_backup
(or if folder doesn’t exist)
Enter the folder name to back up:
nofolder
Folder does not exist!
🌟 Project 2: Make a Simple To-Do List Script
#!/bin/bash
echo "Enter a new task:"
read task
echo "$task" >> todo.txt
echo "Task added!"
echo "Your to-do list:"
cat todo.txt
✅ To-Do List Script Example Output
Enter a new task:
Finish homework
Task added!
Your to-do list:
Finish homework
(Next time you add another)
Enter a new task:
Call mom
Task added!
Your to-do list:
Finish homework
Call mom
🌟 Project 3: Check Disk Space and Warn if Full
#!/bin/bash
usage=$(df / | tail -1 | awk '{print $5}' | sed 's/%//')
echo "Disk usage: $usage%"
if [ "$usage" -ge 80 ]; then
echo "⚠️ Warning: Disk usage is over 80%!"
else
echo "Disk space is OK."
fi
✅ Disk Space Checker Example Output
Disk usage: 45%
Disk space is OK.
or
Disk usage: 85%
⚠️ Warning: Disk usage is over 80%!