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


Click here to return to the 'Re: man uses more by default' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
Re: man uses more by default
Authored by: EphraimWoody on Mar 28, '02 09:51:18AM

Also looking for a permanent system-wide fix, I replaced /usr/bin/more with a copy of /usr/bin/less. SO far, I have not had any problems (it has been three years)





[ Reply to This | # ]
Re: man uses more by default
Authored by: sjk on Mar 28, '02 08:33:10PM

Yeah, who cares if you're the only one using your machine? Many years as a sysadmin of multi-user Unix systems has me trained to leave the "system" environment as generic as possible to help reduce novice user confusion, make upgrades easier, and other minimimal-support-staff type reasons which have varying degrees of success/failure. Pity the overly-clever wannabee who gets the "brilliant" idea of renaming /usr ... at least that's more interesting than "rm -rf /". :-) Okay, enough OT.



[ Reply to This | # ]
Re: man uses more by default
Authored by: charon on Mar 30, '02 05:14:23PM
Replacing 'more' with 'less' is a very ugly way to use 'less' as the default pager. This is a "Mac" (single user) way of dealing with such problems. Unix gives you much more flexibility for such things:
  1. The shell and other programs use variables (see man page) which allows to customize your system in a flexible, reversible way and on a "per user" basis (by setting / changing the contents of the variable). You can set a system wide default to override the program default. It's still possible for every user, to override the system default, so every user can make his/her own choice of PAGER (.i. e. the hierarchy is program default -> system default -> user setting). To set a variable permanently, you use the configuration file for your login shell (e. g. for bash: system wide: /etc/profile, per user: "~/.bash_profile, ~/.bash_login, ~/.profile, ~/.bashrc, ~/.inputrc). tcsh uses other files. Read the man page for your shell (look for keywords such as "invocation", "startup", "login", "environment", ..)
  2. On Unix systems where you don't have administrator permissions, you normally can't remove/rename programs. So changing things the "hard way" wouldn't work. Don't get dependent on solutions which are not of a general nature!
  3. Some programs change their behavior depending on the way they are called (e. g. when a program has a "compatibility mode" to a similar program or older version with another name). Instead of having to call the program with a mode option, you call it by a different name. E. g. you can invoke the bash shell by calling 'bash'. If on your system 'sh' is a link to 'bash' and you invoke 'bash' by calling 'sh', 'bash' will try to mimic the 'sh' behavior. This is an elegant mechanism of dealing with compatibility, since programs calling 'sh' don't have to be rewritten. Thus renaming Unix programs can have unexpected side effects ..
  4. If you do it the "hard way", it's better to:
    • rename 'more' to 'more.original'
    • create a symbolic link named 'more' pointing to 'less' Note: this is better than just make a copy of 'less' and name it 'more' because:
      • you don't waste space
      • the user can see, that calling 'more' is really nothing else than calling 'less' ('ls -la /usr/bin/more' tells you, that 'more' is linked to 'less')
      • you don't have to rename 'less'. Think what will happen when program A is used by program B and you rename A to something else (as you did with 'less'). B has a problem ..
      • switching to another pager is easy: just change the link to the different pager
    To revert to the original state, you simply move 'more.original' to 'more'.
Just my .02$

[ Reply to This | # ]
Re: man uses more by default
Authored by: sjk on Mar 30, '02 06:50:20PM
4. If you do it the "hard way", it's better to: - rename 'more' to 'more.original'

[ Reply to This | # ]
Re: man uses more by default
Authored by: charon on Mar 31, '02 09:31:50PM
What I do is create .DIST and .OFF directories for saving original copies of distribution files (in .DIST) and for those I've deactivated (in .OFF). Less sloppy than using filename extensions, IMHO.
Agreed. Using extensions is not a crime (Unix doesn't care for extensions) but too many '.orig', '.old', '.sav', etc. files can "litter" the filesystem. Your way is cleaner, if you have to go the "hard way".. (but avoiding the "hard way" is better). Another possible solution for saving original copies is a version control system (RCS/CVS). I started using CVS for system configuration files and shell/SQL scripts. With version control, it is possible to switch back to any previous state of a file without having to deal with the naming or placing of the old files. Furthermore, you can comment changes and group file versions belonging together, etc..

[ Reply to This | # ]