Ubuntu's Success Story: the Upstart Startup Manager (LinuxPlanet)
Posted Apr 12, 2010 6:09 UTC (Mon) by keybuk
In reply to: Ubuntu's Success Story: the Upstart Startup Manager (LinuxPlanet)
Parent article: Ubuntu's Success Story: the Upstart Startup Manager (LinuxPlanet)
For a long time, I strongly considered having Upstart run all of its shell processes with "set -u" (it already runs them all with "-e"). Unfortunately "-u" has surprising results, even for those who are used to shell programming!
For example, the following is a very common way to test whether a parameter is not in fact set:
if [ -z "$MOUNTPOINT" ]; then
The use of
$MOUNTPOINT in the test is still considered an expansion, thus if you try and run this, you get:
/proc/self/fd/4: 1: MOUNTPOINT: parameter not set
There are obviously ways to write the code so that it works with "-u", e.g.:
but I figured that more people wouldn't know these, and would simply get frustrated at Upstart's apparent inability to run (in their mind) perfectly cromulent shell scripts.
to post comments)