Ubuntu Shell Script
up.sh
A script that runs aptitude to update installed packages.
#!/bin/sh
# Returns just the user ID number from the id command.
getUID() {
id $1 | sed -e 's/(.*$//' -e 's/^uid=//'
}
if [ "`getUID`" -gt 100 ]; then
echo "ERROR: Insufficient privileges. Use sudo."
exit 1
fi
echo "(BEGIN UPDATE)"
aptitude update
echo "(UPDATE DONE)"
sleep 3
echo "(BEGIN UPGRADE)"
aptitude safe-upgrade
echo "(UPGRADE DONE)"
exit 0
Obviously there is not much code on this page. I have tended to post code on my blog at BlueCog.com instead of here.
