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

Re: [[ -x =command ]]



On 2007-10-17 17:29:21 +0200, Frank Terbeck wrote:
> This will break for old things like opensolaris' /bin/sh.
> If you leave the 'command' bit out, it'll work:
> 
>     which most >/dev/null && { PAGER=most; export PAGER; }
> 
> Yeah, an alias or a function called 'which' would break that. But it's
> more portable than the 'command' approach.

"which" is a broken csh script under Solaris, because it reads the
user's .cshrc, with all the side effects you can imagine...

Moreover, the command may exist but not work (this happens with
dynamically linked executables under NFS, if some library isn't
locally installed on some machines). So, the best solution is to
try the command with some option like --version.

-- 
Vincent Lefèvre <vincent@xxxxxxxxxx> - Web: <http://www.vinc17.org/>
100% accessible validated (X)HTML - Blog: <http://www.vinc17.org/blog/>
Work: CR INRIA - computer arithmetic / Arenaire project (LIP, ENS-Lyon)



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