(Hello Ralph.) Ralph Corderoy <[email protected]> wrote: |>> $ >/tmp/foo |>> $ PATH=/tmp:$PATH bash -c 'command -v foo' |>> /tmp/foo |>> $ >/tmp/ls |>> $ PATH=/tmp:$PATH bash -c 'command -v ls' |>> /usr/bin/ls |> |> Boo-ho!! To me this looks like a bug in bash and dash | |No. My command(1p) says | | -v Write a string to standard output that indicates the pathname | or command that will be used by the shell, in the current | |and it's true; the pathname is used by the shell. | | $ ls -l /tmp/foo | -rw-r--r-- 1 ralph ralph 14 Sep 4 13:47 /tmp/foo | $ PATH=/tmp:$PATH bash -c foo | bash: /tmp/foo: Permission denied
In the meanwhile i have found out that bash does not find that when POSIXLY_CORRECT is set, and will adjust the stuff accordingly. |autoconf's ./configure here does | | test -f "$1" && test -x "$1" | |rather than command(1). The full fix would be to iterate over $PATH from left to right and find something really executable. I think that is even better. I have also opened an issue on austinbugs, which(1) would do it but is not standardized... Thanks for the digging, Ralph, and for the reporting, Norman! --steffen | |Der Kragenbaer, The moon bear, |der holt sich munter he cheerfully and one by one |einen nach dem anderen runter wa.ks himself off |(By Robert Gernhardt)
