* Ian Jackson <ijack...@chiark.greenend.org.uk>, 2014-05-07, 14:32:
I came across this in /etc/init.d/exim4:
OLDIFS="$IFS"
IFS=:
for p in $PATH; do
if [ -x "$p/$UPEX4CONF" ]; then
IFS="$OLDIFS"
$p/$UPEX4CONF $UPEX4OPTS
return 0
fi
done
IFS="$OLDIFS"
I imagine that this kind of thing is found in many other places.
This is what Developer's Reference §6.4 recommends. (Strangely enough
§6.4 is supposed to be about maintainer scripts. But maintainer scripts
can safely assume that /usr is mounted, and use /usr/bin/which instead
of this monster.)
So yeah, it's very likely that we have many instances of similar code in
the archive.
It seems to me that given that dash and bash both provide `type', and
the underlying functionality necessarily exists in the shell, it would
be better to mandate that the shell expose it.
Alternatively, we could bless "command -v", which is a nicer interface
IMO, and it's also supported by bash, dash and mksh.
--
Jakub Wilk
--
To UNSUBSCRIBE, email to debian-policy-requ...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org
Archive: https://lists.debian.org/20140607195234.ga7...@jwilk.net