On 1/7/10 8:39 AM, Giuseppe Scrivano wrote: > Hello, > > what do you think about make this the default behavior, not only when > POSIXLY_CORRECT is specified? A `stat' is very fast, the cost of a > stat+fork+exec is almost the same of a fork+exec.
If you want to make this your default behavior, enable the `checkhash' option with shopt. > I have a question: how bash should behave in the case you have: > > ------------------------------------------- > export PATH=a:b:$PATH > > mkdir a b > > cat > b/prog.sh << EOF > echo b/prog.sh > EOF > > chmod +x b/prog.sh > > prog.sh > > cat > a/prog.sh << EOF > echo a/prog.sh > EOF > > chmod +x a/prog.sh > > prog.sh > ------------------------------------------- > > > Which prog.sh should be used in this case? a/prog.sh or b/prog.sh? The > former has a higher precedence in PATH but the latter is the hashed > value. The hashed value should be preferred as long as it exists. If you're concerned about this being a problem, run `hash prog.sh' after creating it. Chet -- ``The lyf so short, the craft so long to lerne.'' - Chaucer ``Ars longa, vita brevis'' - Hippocrates Chet Ramey, ITS, CWRU c...@case.edu http://cnswww.cns.cwru.edu/~chet/