Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: [patch] "which"-builtin writes diagnostics to stdout



On Sep 1,  8:12am, Mikael Magnusson wrote:
}
} I guess the problem here is that in other shells, whence does not
} exist, and which prints 'not found' to stderr.

As far as I can tell, in other shells "which notacommand" prints NOTHING
on stdout or stderr.

} Zsh's which acts like the csh variant even in the sh emulation, so
} finding the absolute path of a command portably is pretty difficult.

Really?  This seems to work pretty well in bash/ksh/zsh (I don't have
dash/ash to try):

    if absolute_path="$(which $1)"
    then echo "Absolute path of $1 is $absolute_path"
    fi



Messages sorted by: Reverse Date, Date, Thread, Author