Bob Hilliard wrote: > I suspect the easy availability of script(1) discouraged people > from expending any effort on it. I finally got tired of editing out > all the bogus newlines (^M) from script's output, so I wrote the > following wrapper for apt-get, which I have installed as > /usr/local/bin/upgrade: > > #! /bin/bash > # A script to wrap `apt-get -dist-upgrade' to keep a log of upgrades > > echo -e "\n\n `date`\n">>upgrade_log > apt-get -qu dist-upgrade 2>&1 |tee -a upgrade_log > exit 0 > > This contains several bashisms, so it shouldn't be run with > #!/bin/sh. You still have to stand by to answer apt's and debconf's > questions. You could eliminate all of the non-portable stuff in the above by changing the single 'echo -e' to 'printf'. This is functionally equivalent. #! /bin/sh # A script to wrap `apt-get -dist-upgrade' to keep a log of upgrades printf "\n\n `date`\n\n">>upgrade_log apt-get -qu dist-upgrade 2>&1 |tee -a upgrade_log exit 0 It annoys me that bash's echo and therefore /bin/sh requires -e which in the case of /bin/sh is a violation of the standards. I have given up and just use printf whenever I need escape sequences. Bob
Attachment:
pgpLiWMJqqtuJ.pgp
Description: PGP signature