From: [EMAIL PROTECTED] (Bodo Moeller)
bmoeller> > +#
bmoeller> > +# Find the full pathname(s) of bc
bmoeller> > +#
bmoeller> > +findBc()
bmoeller> > +{
bmoeller> > + IFS=:
bmoeller> > + for i in $PATH; do
bmoeller> > + eval test -x $i/bc -a ! -d $i/bc && { echo $i/bc ; }
bmoeller> > + done
bmoeller> > +}
bmoeller>
bmoeller> On usual shells this looks for files with names such as
bmoeller> '/usr/local/bin:/usr/bin:/bin/bc', but not for '/usr/local/bin/bc',
bmoeller> '/usr/bin/bc' and '/bin/bc'.
Uhmmm, is that something you found out by testing, or did you miss the
line saying IFS=:? I wanna recall learning about that one in 1985,
but I may be mixing things up... If it was there in '85, I do not
expect it to have disappeared today...
bmoeller> Also lots of quotes are missing (if variable i had the
bmoeller> correct value, "$i/bc" would be the file to look at, not
bmoeller> $i/bc).
Why are those quotes needed? The only reason I can think if is to
support paths that contain characters that are subject to expansion or
separation...
bmoeller> Assuming that those problems are corrected, can we rely on shell
bmoeller> functions to work everywhere?
As far as I know, shell functions are a defined part of sh.
bmoeller> Also, is this really worth the effort? Usually you don't
bmoeller> encounter more than two 'bc's on the same system, with GNU
bmoeller> bc (if available) in a preferred PATH directory.
"Usually"... I think it's worth it.
--
Richard Levitte \ Spannvägen 38, II \ [EMAIL PROTECTED]
Chairman@Stacken \ S-168 35 BROMMA \ T: +46-8-26 52 47
Redakteur@Stacken \ SWEDEN \ or +46-709-50 36 10
Procurator Odiosus Ex Infernis -- [EMAIL PROTECTED]
Member of the OpenSSL development team: http://www.openssl.org/
Software Engineer, Celo Communications: http://www.celocom.com/
Unsolicited commercial email is subject to an archival fee of $400.
See <http://www.stacken.kth.se/~levitte/mail/> for more info.
______________________________________________________________________
OpenSSL Project http://www.openssl.org
Development Mailing List [EMAIL PROTECTED]
Automated List Manager [EMAIL PROTECTED]