From: troyzeng on
How to explain the following?
$ pwd
/home/user1
$ which ./a.sh
../a.sh
$ which ./a.sh | grep '.*'
/home/user1/a.sh
$ which ./a.sh | tee /dev/null
/home/user1/a.sh

It gives the full path as long as it's piped.
From: mop2 on
Please, redo and confirm:
$ which ./a.sh
../a.sh

If yes, and this:
$ which ./a.sh | cat


troyzeng wrote:
> How to explain the following?
> $ pwd
> /home/user1
> $ which ./a.sh
> ./a.sh
> $ which ./a.sh | grep '.*'
> /home/user1/a.sh
> $ which ./a.sh | tee /dev/null
> /home/user1/a.sh
>
> It gives the full path as long as it's piped.
From: troyzeng on
On 25 Apr, 11:55, mop2 <mop2bky4mz5tyjwa8ersp7hrg5u...(a)gmail.com>
wrote:
> Please, redo and confirm:
> $ which ./a.sh
> ./a.sh
>
> If yes, and this:
> $ which ./a.sh | cat
>
> troyzeng wrote:
> > How to explain the following?
> > $ pwd
> > /home/user1
> > $ which ./a.sh
> > ./a.sh
> > $ which ./a.sh | grep '.*'
> > /home/user1/a.sh
> > $ which ./a.sh | tee /dev/null
> > /home/user1/a.sh
>
> > It gives the full path as long as it's piped.

$ which ./a.sh | cat
/home/user1/a.sh

It also returns the full path.
From: Stephane CHAZELAS on
2008-04-24, 18:35(-07), troyzeng:
> How to explain the following?
> $ pwd
> /home/user1
> $ which ./a.sh
> ./a.sh
[...]

"which" is a non-standard command. You could get anything, there
exist a lot of implementations behaving differently.

Try "command -v" instead.

--
St�phane