
| From: Bob Jonkman <bjonkman@sobac.com> Thanks. Here's a slightly shorter version. Picky, picky, picky. Looking gift horse in the mouth. I try to start all my scripts with "set -eu" so that more bugs will be detected. "set -e" causes the shell to exit if a command unexpectedly fails. That is, a command returns non-zero and was invoked in a non-test context. Just what you want. "set -u" tells the shell to treat a reference to an undefined parameter as an error. It will make no difference in this script. Until the script evolves more complexity. | ===== update script ===== | #! /bin/bash | | # Program: update | # Purpose: Perform 4-step apt-get update, dist-upgrade, autoremove and autoclean | # Author: Bob Jonkman | # Date: 22 March 2012 set -eu | echo "Update:" | apt-get update | | echo "Upgrade:" | apt-get -y dist-upgrade | | echo "Auto-remove:" | apt-get -y autoremove | | echo "Auto-clean:" | apt-get autoclean | | if [ -e "/var/run/reboot-required" ] | then | echo | echo "Reboot required by " I think that this should be echo -n "Reboot required by " or echo "Reboot required by" | cat /var/run/reboot-required.pkgs | fi | | # EOF: update