On Monday 01 February 2010 12:07:28 Oliver Fromme wrote: > The "which" command (whether shell-builtin or /usr/bin/which > doesn't matter) simply looks at the PATH environment variable: > It opens every directory, one after another, and looks for > the binary. It is first found in /usr/pkg/bin. Note that > the linuxulator doesn't redirect the directory because > /compat/linux/usr/pkg/bin doesn't exist. So the "which" > command prints /usr/pkg/bin/bash. The same happens when > you type "/usr/pkg/bin/bash" because this path doesn't exist > under /compat/linux, so you'll get the DFly bash. > > However, when you only type "bash" at the Linux bash prompt, > it simply forks a subshell of itself, so you get the Linux > bash again.
/bin is before /usr/pkg/bin in $PATH, so that's not why. The reason appears to be that which is a BSD program, so it sees only the BSD programs in /bin, and bash isn't there. When Linux bash runs bash, however, it looks in /bin and finds itself. If I put /usr/pkg/bin before /bin, Linux bash finds BSD bash: bash-3.00# PATH=/usr/pkg/bin:$PATH bash-3.00# bash bash-3.2# Pierre -- When a barnacle settles down, its brain disintegrates. Já não percebe nada, já não percebe nada.
