System Update Checker Bash Script

marius

Administrator
Staff member
Introduction:
This script checks for available system updates on Debian-based systems and displays the summary to the user.

Code Snippet:
Bash:
#!/bin/bash
# System Update Checker
sudo apt update > /dev/null 2>&1
UPDATES=$(apt list --upgradable 2>/dev/null | wc -l)

if [ "$UPDATES" -gt 1 ]; then
  echo "There are updates available."
else
  echo "Your system is up-to-date."
fi

Instructions:
To use the script, run the following commands:
Code:
chmod +x update_checker.sh
./update_checker.sh

Example Output:
Code:
There are updates available.
 
Back
Top