Re: result of `which ./a.sh`



2008-04-26, 16:02(+00), Kenny McCormack:
In article <slrng12ule.4qn.stephane.chazelas@xxxxxxxxxxxxxxx>,
Stephane CHAZELAS <this.address@xxxxxxxxxx> wrote:
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.

That don't work at all:

% command -v instead
command: Command not found.
[...]

You forgot the quotes and the dot, and your prompt is incorrect:

$ "command -v" instead.
../a.sh

Having said that, it's true that csh and zsh will probably be
the shells with which "which" will work best as which at least
traditionnaly was only intended for csh users (as it was a csh
script reading the user's cshrc) and it's also built in zsh
(alias for "whence -c").

--
Stéphane
.



Relevant Pages

  • Re: rm - Arguments too long
    ... > popeye$ ls one ... r doesn't repeat the last command *run*, ... ksh I need to build the string then embed it in a while true; do loop. ... On the other hand ksh and bash have an advantage in command recall over csh ...
    (comp.unix.admin)
  • Re: rm - Arguments too long
    ... > popeye$ ls one ... r doesn't repeat the last command *run*, ... ksh I need to build the string then embed it in a while true; do loop. ... On the other hand ksh and bash have an advantage in command recall over csh ...
    (comp.unix.solaris)
  • Re: rm - Arguments too long
    ... > popeye$ ls one ... r doesn't repeat the last command *run*, ... ksh I need to build the string then embed it in a while true; do loop. ... On the other hand ksh and bash have an advantage in command recall over csh ...
    (comp.unix.misc)
  • Re: setting a variable in csh
    ... this a csh goodie: the environment variable is called PATH! ... % echo $path ... If I want to execute a command in the current ... It will execute the system "test" command, ...
    (comp.unix.shell)
  • Re: Csh - How to distinguish between symbolic link and directory in script?
    ... local directory or a symbolic link. ... > number" (apparently the builtin test functionality of the csh doesn't ... Back quotes give you the output of a command, but test has no output, ... only an exit status. ...
    (comp.unix.shell)