Re: which..
maor@ece.utexas.edu (Guy Maor) said:
>
> Argh! What a can of worms this has opened up. I've tested which on
> several other systems and also looked at the source of the 2 examples
> posted. The problem is that they all have DIFFERENT behavior.
>
> What do you do given two arguments, "which ls cat", for example? Print
> them both out? Print only the first?
>
> What do you do if nothing is found? Print nothing? Print something?
> exit 1?
>
> I'll just pick some reasonable behavior. I guess there is no real
> convention. Real shells use "type".
>
>
> Guy
>
>
Well as I have metioned earlier, IMHO which is from tcsh, so the correct
behaviour is what tcsh does. However I realise that different implementations
of tcsh might have different behaviour, so this might not solve the problem.
This is what happens at work, on a SUN running Solaris:
mpw wtree 78 > which ls cat
ls: aliased to ls -F
/usr/bin/cat
mpw wtree 79 > which arne
arne: Command not found.
Hopefully helpful,
MartinS
Reply to: