Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!


Click here to return to the 'Where to put the less -S flag' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
Where to put the less -S flag
Authored by: gshenaut on Jan 21, '05 01:33:00PM

Adding an -S flag after $PAGER is not a good way to do this, because it assumes that PAGER is set to less(1). Consider what would happen if PAGER were set in the environment to some other command, such as "xmessage -file -": if there is an -S flag after $PAGER, the program will simply fail to work.

If you look at the script, you will see that PAGER is defined to less plus some flags (PAGER="less -Rse"; the flags mean interpret control chars, squeeze multiple empty lines to one, and exit at EOF). It would make perfect sense to add the S flag to that definition ("PAGER=less -SRse") instead of the cut filter I suggested.

But, the -S flag is a good steer, thanks.

Greg Shenaut



[ Reply to This | # ]
Where to put the less -S flag
Authored by: arekkusu on Jan 21, '05 02:11:40PM

But, it is only set to less if it is undefined. What if you normally have it set to something else, like 'less -ERmX~'?



[ Reply to This | # ]
Where to put the less -S flag
Authored by: gshenaut on Jan 21, '05 04:12:09PM
Yeah, it's kind of an endless loop, isn't it? Well, you could put an "apropos" shim like this into your personal bin directory:
#!/bin/sh
PAGER="less -xxxS"; export PAGER
exec /usr/bin/apropos $*
so that the PAGER definition is overridden. I still think the original file should be changed by adding the -S to its default PAGER definition. (The "xxx" gets replaced with whatever your other less preferences are.)

Greg Shenaut

[ Reply to This | # ]