/bin/true
Greg Noel
greg at ncr-sd.UUCP
Sat May 3 06:36:05 AEST 1986
In article <401 at brl-smoke.ARPA> gwyn at brl.ARPA writes:
>[The true and false commands] main use is to hang system-type links on.
>For example, on the system I'm typing this on, "gould" is linked to "true"
>and other system types such as "vax" are linked to "false". These commands
>are very useful if you maintain code for multiple systems all in the same
>place.
Well, I admit that doing it that way is better than nothing, but I've been
in the same environment and I've always considered it a bit of a misfeature.
The problem is one of future compatibility -- if you add a new machine type,
you have to put in a link on every machine in the world. A better scheme
would have been a single command, say "machid", that only consisted of the
command "echo gould". Then, the usual sequence of:
if pdp11; then ...
elif vax; then ...
elif pyr; then ...
elif gould; then ...
elif tower; then ...
elif sequent; then ...
elif amiga; then ...
elif telefunken; then ....
else echo "I don't know how to handle this machine"; fi
(an exageration, admittedly, but do \you/ have links for all those machines?)
becomes:
case `machid` in
pdp11) ... ;;
vax) ... ;;
pyr) ... ;;
gould) ... ;;
tower) ... ;;
sequent) ... ;;
amiga) ... ;;
telefunken) ... ;;
*) echo "I don't know how to handle machine-type `machid`" ;;
esac
This is no more difficult to manage, and easy to extend compatibly. And if
you don't have a link for "telefunken" then it doesn't cause your makefile
to punt.......
--
-- Greg Noel, NCR Rancho Bernardo Greg at ncr-sd.UUCP or Greg at nosc.ARPA
More information about the Comp.unix
mailing list