[systemd-devel] [PATCH] systemctl: implement auto-pager a la git

Tollef Fog Heen tfheen at err.no
Tue Jan 4 00:29:34 PST 2011


]] Lennart Poettering 

| Can you elaborate on the precise semantics of pager(1) and
| sensible-pager(1)? I found the latter man pages online and hence added
| this to the things systemctl will now look for by default. But "pager"
| was a little bit too generic to find anything. 

pager(1) is the alternative provided by less, more, most, dog, pg and so
on.

sensible-pager is a small shell script:

#!/bin/sh

${PAGER:-pager} "$@"
ret="$?"
if [ "$ret" -eq 126 ] || [ "$ret" -eq 127 ]; then
more "$@"
ret="$?"
	if [ "$ret" -eq 126 ] || [ "$ret" -eq 127 ]; then
		echo "Couldn't find a pager!" 1>&2
		echo "Set the \$PAGER environment variable to your desired pager." 1>&2
		exit 1
	fi
fi

So if you set PAGER in your environment, that'll be preferred, else
it'll use pager(1), else it'll fall back to more (since that's in
util-linux, it's guaranteed to be available).

Regards,
-- 
Tollef Fog Heen
UNIX is user friendly, it's just picky about who its friends are


More information about the systemd-devel mailing list