Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: [[ -x =command ]]
- X-seq: zsh-users 12024
- From: Matthew Wozniski <godlygeek@xxxxxxxxx>
- To: zsh-users@xxxxxxxxxx
- Subject: Re: [[ -x =command ]]
- Date: Wed, 17 Oct 2007 07:34:32 -0400
- Cc: Stephane Chazelas <Stephane_Chazelas@xxxxxxxx>
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=beta; h=domainkey-signature:received:received:received:date:from:to:cc:subject:message-id:references:mime-version:content-type:content-disposition:in-reply-to:x-editor:user-agent; bh=KXXSSyEVHodFKGFKSdJilWf5TrtZyrBYJy+PZRpxu5I=; b=N1nF93hQw2PZjO58GmsoTbT5eamIgJK27w4Hv+louFaGCiIYK9Xq5zDpeUoyF4OpyA7/LAl6T2aQc/SrzAmMfTHLcwvQ8s3l42epecqg60bRzp+AzSxCx3Ile257pXe0bS8cKmlfxwT4Em6CCLlAfCJW9Oq6KmKZZoqvcGA5Z5k=
- Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=beta; h=received:date:from:to:cc:subject:message-id:references:mime-version:content-type:content-disposition:in-reply-to:x-editor:user-agent; b=eG+Kxvh6qp38Dd5b/Ou3TqR6jGHYX3S8p0n3HiJ+p2I8nbxFII5B+IlthFR/cLCmtsuj0dzC8IacdJQHfaUphC1BFYgMHplPqrKoX67+y9jX/Tf7tTOhU9CrUORn64BNUz4xO5GO0XvyJrBGa2JuHo8DxKY5YrM2Gpfv0BXHg9Q=
- In-reply-to: <20071017094414.GA5383@xxxxxxxxxxxxxxx>
- Mailing-list: contact zsh-users-help@xxxxxxxxxx; run by ezmlm
- References: <20071016210548.26560.qmail@xxxxxxxxxxx> <20071016211319.GA2910@xxxxxxxxxxxxxxx> <20071016214100.62242.qmail@xxxxxxxxxxx> <20071017094414.GA5383@xxxxxxxxxxxxxxx>
On Wed, Oct 17, 2007 at 10:44:14AM +0100, Stephane Chazelas wrote:
> zmodload -i zsh/parameters
> export PAGER=\
> ${commands[most]:-\
> ${commands[less]:-\
> ${commands[w3m]:-\
> ${commands[pager]:-\
> more}}}}
>
> or, portably:
>
> for PAGER in most less w3m pager more; do
> command -v "$PAGER" > /dev/null 2>&1 && break
> done
> export PAGER
>
> as I don't think you need the full path in $PAGER.
Hm. `command -v more' and `$commands[more]' aren't equivalent, it
seems.
mastermind% echo $commands[ls]
/bin/ls
mastermind% command -v ls
alias ls='ls --color=auto -B'
So, just for the sake of argument, if one were to have aliased `most'
to `less' on a machine that didn't have most, the first form would
work properly, but the second would result in a false positive and
fail when an application tried to use $PAGER, since no alias expansion
would be performed.
~Matt
Messages sorted by:
Reverse Date,
Date,
Thread,
Author