On Wed, Nov 19, 2008 at 12:13 PM, Cathey, Jim <[EMAIL PROTECTED]> wrote:
> I believe it is customary to use an environment
> variable PAGER to allow overriding of less (or
> more, or whatever the system default is). In ksh-speak:
>
> case $pagefile in
> *.bz2)
> bzcat $pagefile | ${PAGER:-less} ;;
> *.gz)
> zcat $pagefile | ${PAGER:-less} ;;
> *)
> ${PAGER:-less} $pagefile ;;
> esac
>
> -- Jim
>
Ah, I forgot about the PAGER variable. Good catch :D.
Doesn't seem like msh and bb's sh have the nice default value
expansion like ksh and bash have. The following works just as well
though:
[ -z $PAGER ] && PAGER=less
#okay, found the page, try decompressing and displaying
case $pagefile in
*.bz2)
bzcat $pagefile | $PAGER ;;
*.gz)
zcat $pagefile | $PAGER ;;
*)
$PAGER $pagefile ;;
esac
and if someone were lacking less and more they can just set PAGER to
cat a viola, lots of scrolling.
~Matthew Hiles
_______________________________________________
busybox mailing list
[email protected]
http://busybox.net/cgi-bin/mailman/listinfo/busybox