tech-userlevel archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: PAGER=less



On 15.10.2011 16:39, Greg Troxel wrote:
> 
> Zafer Aydoğan <zafer%aydogan.de@localhost> writes:
> 
>> I would like to see the PAGER environment variables in dot.profile and
>> dot.cshrc to be "less" instead of "more" by default.
>> I am always annoyed when more (unexpectedly) exits, when I scroll to
>> the end of a man page, or jump to the end of it (shift-G)
>> and can't scroll back.
>> Do you have similiar experiences and how do you avoid it ?
>> What do you think about the change ?
> 
> I would prefer to see system shell initialization files do less, not
> more, and thus not set environment variables at all unless there's a
> compelling need (perhaps PATH).
> 
> IMHO this is a preference issue, and should be left to users to set in
> their own dotfiles; people should get raw unix default behavior until
> they ask for something different.

Agreed, changing system-wide configuration is certainly not good there.

What about the attached patch? Considering that /usr is not necessarily
mounted when a root shell is invoked, I am using which to check for
vi/less presence.

As it comes from skel files, users are free to edit theirs afterwards.

-- 
Jean-Yves Migeon
jeanyves.migeon%free.fr@localhost
Index: root/dot.profile
===================================================================
RCS file: /cvsroot/src/etc/root/dot.profile,v
retrieving revision 1.25
diff -u -p -r1.25 dot.profile
--- root/dot.profile    21 Jun 2011 05:31:29 -0000      1.25
+++ root/dot.profile    15 Oct 2011 17:07:37 -0000
@@ -21,6 +21,14 @@ umask 022
 
 export ENV=/root/.shrc
 
+if [ -x `which vi` ]; then
+       export EDITOR=vi
+fi
+
+if [ -x `which less` ]; then
+       export PAGER=less
+fi
+
 # Do not display in 'su -' case
 if [ -z "$SU_FROM" ]; then
         echo "We recommend that you create a non-root account and use su(1) 
for root access."
Index: skel/dot.profile
===================================================================
RCS file: /cvsroot/src/etc/skel/dot.profile,v
retrieving revision 1.5
diff -u -p -r1.5 dot.profile
--- skel/dot.profile    19 Nov 2008 18:07:20 -0000      1.5
+++ skel/dot.profile    15 Oct 2011 17:07:37 -0000
@@ -15,6 +15,6 @@ export PATH
 
 export EDITOR=vi
 export EXINIT='set autoindent'
-export PAGER=more
+export PAGER=less
 
 export ENV=$HOME/.shrc


Home | Main Index | Thread Index | Old Index