Solución
Una versión menos mano de knitatoms' answer combinado con Alex Marteilli's answer funciona bastante bien: Paso de la opción +Gg
a less
a través de su opción de buscapersonas.
Por ejemplo, trate
man -P 'less -s -M +Gg' man
Esto se puede realizar de forma permanente, poniendo
export MANPAGER='less -s -M +Gg'
en uno de los archivos de configuración de shell (por encima de la sintaxis es para Bash y ZSH). Ahora, por ejemplo, man man
muestra el porcentaje que desea .
Advertencia
Usted debe no poner el +Gg
en la variable LESS
! Por ejemplo, haciendo
export LESS='-M +Gg'
causará problemas al leer archivos muy grandes. Por ejemplo,
yes | LESS='-M +Gg' less
no funciona muy bien ...
Explicación
Como otras respuestas han explicado, el problema es que less
no se puede decir lo ciento en el archivo que está hasta que sepa cuánto dura el archivo , y no lee hasta el final del archivo de forma predeterminada al leer desde un conducto.
Desde la sección de OPTIONS
man less
:
+ If a command line option begins with +, the remainder of that
option is taken to be an initial command to less. For exam‐
ple, +G tells less to start at the end of the file rather than
the beginning, and +/xyz tells it to start at the first occur‐
rence of "xyz" in the file. As a special case, +<number> acts
like +<number>g; that is, it starts the display at the speci‐
fied line number (however, see the caveat under the "g" com‐
mand above). If the option starts with ++, the initial com‐
mand applies to every file being viewed, not just the first
one. The + command described previously may also be used to
set (or change) an initial command for every file.
Los medios g
"Para volver al principio del archivo".
Desde el man man
:
-P pager, --pager=pager
Specify which output pager to use. By default, man uses pager
-s. This option overrides the $MANPAGER environment variable,
which in turn overrides the $PAGER environment variable. It
is not used in conjunction with -f or -k.
The value may be a simple command name or a command with argu‐
ments, and may use shell quoting (backslashes, single quotes,
or double quotes). It may not use pipes to connect multiple
commands; if you need that, use a wrapper script, which may
take the file to display either as an argument or on standard
input.
Esto parece infinitamente recursivo. es decir, la llamada al hombre dentro de la función llamará a la función 'hombre', no al ejecutable' hombre'. – Yuliy
Abrí un nuevo hilo para el nuevo problema: http://stackoverflow.com/questions/1053707/unable-to-make-a-shell-function-in-bash-zsh –
@Yuliy: Hiciste el movimiento crucial. Necesitamos desvincular la función man de alguna manera configurando una variable ficticia, tal vez. –