Alexander Steinböck <bts@bts.grml.org>:
> Alexander Steinböck <z3ttacht@grml.org> added the comment:
> One thing I forgot to mention.
>
> IMHO testing for $PAGER as in
>
> ,----[ /etc/skel/.zshrc ]-
> | +if check_com -c $PAGER ; then
> `----
>
> which originated from the same test with most, is _not_ necessary,
> since $PAGER gets definitely set.
>
> ,----[ /etc/zsh/zshrc ]-
> | +(( ${+PAGER} )) || export PAGER="less"
> `----
>
> Arguments for keeping it? (o;
Sure, it's not the same thing.
check_com() checks if the command stored in $PAGER is available.
The latter snippet checks if $PAGER is empty and if so, sets it to
'less'. My personal preference would be to use PAGER=${PAGER:-less}
there, because, IMHO it's a lot clearer.
However we should make sure that the 'export PAGER=${PAGER:-less}'
code is issued *before* the check_com() line. Because check_com()
requires a command to be checked for. An empty string would be a
rather weird command name. :-)
Patch welcome, btw.
I'll be afk until the evening.
Regards, Frank
--
In protocol design, perfection has been reached not when there is
nothing left to add, but when there is nothing left to take away.
-- RFC 1925 |