With the mungled PATH which was /usr/bin/which . From all Viktor said, is then best to rename my previous csh scripts to .<script>.old ?

With PATH having /usr/bin before /sw/bin the 'which' being called was indeed /usr/bin/which

Now 'type which' reports which is /sw/bin/which

I am studying a book on BASH but I hadn't encounter yet the differences on 'which' and 'type'.

Thanks also to Ettore for mentioning 'type': recreating the *ill* environment type emacs was indeed /usr/bin/emacs while 'which/emacs' was again /sw/bin/emacs and which was /usr/bin/which. Pretty confusing but Viktor explains what happens behind the scenes.

Thanks to all again

On Friday, November 22, 2002, at 11:38 PM, Viktor Haag wrote:

Massimo Marino writes:
Does bash behave differently from (t)csh? I did not check the
PATH because /sw/bin/emacs is exactly what I wanted but still
/usr/bin/emacs was the one got called. How 'which' in bash
gets updated? any 'rehash' equivalent?
Bash doesn't have a 'which' builtin like csh does, and therefore
doesn't need a 'rehash'. When you use 'which' in bash, you're
actually depending on another util.

Here's something that might be useful to know: fink's which
reports that it uses the environ's current $PATH to find the
executable you specify. However, the man page for /usr/bin/which
says that it looks instead in .cshrc and uses the PATH *there* to
locate the file.

If this is the case, then perhaps you set PATH in your .cshrc
file, then 'source /sw/bin/init.csh' (which of course
/usr/bin/which would ignore), and you're invoking /usr/bin/which
for some reason (like you don't have /sw/bin/which installed?).

/usr/bin/which then looks in .cshrc (even though its being
invoked by bash), and finds the malformed PATH, and *voila*: you
get the wrong location for a utility.

You might try testing this with another utility that you also
have in both the base install and in Fink...


V.


--
Massimo Marino
NERSC Division - HPC Department
Lawrence Berkeley National Laboratory http://www.slac.stanford.edu/~marino
On leave at CERN, CH, EP Division, Atlas experiment
phone: (+41) 22 767-1288 fax: (+41) 22 767-8350 Office: 40-3-D16
alternate email: [EMAIL PROTECTED], [EMAIL PROTECTED], [EMAIL PROTECTED]




-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf
_______________________________________________
Fink-users mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/fink-users

Reply via email to