[GRASS5] Arrow keys and default pager

Markus Neteler neteler at geog.uni-hannover.de
Wed Apr 4 09:35:50 EDT 2001


Hi Reinhard,

On Wed, Apr 04, 2001 at 02:47:12PM +0200, Reinhard Brunzema wrote:
> "Eric G. Miller" schrieb:
> > 
> > On Wed, Apr 04, 2001 at 10:43:26AM +0200, Reinhard Brunzema wrote:
> > >
> > > > Second issue: I see that the default pager for GRASS man pager is
> > > > "more",
> > > > but under linux the default pager is usually "less", much more powerful
> > > > and easier to use. I'm getting tired of typing "export PAGER=less" every
> > > > time I login in GRASS... couldn't it be a default option if "less" is
> > > > available on the machine (at least under Linux)?
> > >
> > > Hallo,
> > > I had the same thoughts a couple of days before. A possible solution
> > > would be:
> > >
> > > Replacing the lines
> > > ---
> > >       # Set some environment variables if they are not set
> > >       if [ ! "$PAGER" ] ; then
> > >               PAGER=more
> > >               export PAGER
> > >       fi
> > > ---
> > > with
> > > ---
> > >       # Set some environment variables if they are not set
> > >       if [ ! "$PAGER" ] ; then
> > >               lesspath=`which less 2> /dev/null`
> > >               if [ -x "$lesspath" ] ; then
> > >                       PAGER=less
> > >               else
> > >                       PAGER=more
> > >               fi
> > >               export PAGER
> > >       fi
> > 
> > The "which" command is not Bourne Shell (unfortunately).  I've seen
> > hacks to emulate it...
> 
> Something like:
> ---
> 		# Search for a wish program
> 		WISH=
> 
> 		for i in `echo $PATH | sed 's/^:/.:/
>     		    	    		    s/::/:.:/g
> 					    s/:$/:./
> 					    s/:/ /g'`
> 		do
> 	    	if [ -f $i/$GRASS_WISH ] ; then
>     			WISH=$GRASS_WISH
> 			break
> 	    	fi
> 		done
> ---
> (taken from Init.sh)
> I don't understand, why assuming "sed" is available is better than
> assuming "which" is available. Init.sh already uses several non-sh
> commands (sed, awk, grep, whoami). Why not "which"?

here some explanations:
Unfortunately especially "which" doesn't appear on various platforms.
And also "type -p" even doesn't work everywhere. The others (sed, awk, grep,
whoami) are more common. That's the standardized un*x world :-(

o Linux: $> alias which
  alias which='type -p'

  $> type -p grass5
  /usr/local/bin/grass5

Solaris: $> alias which
  alias: 'which' not found

  $> type -p grass5
  /usr/local/bin/grass5

CRAY: $> alias which
  which: alias not found

  $> type -p grass5
  /usr/local/bin/grass5

We have found platforms (was it SGI) where "type -p" is not present. Urgs.

Sorry, but these commands have to be used very selectively. Maybe we should
add a list of allowed commands to "SUBMITTING"?

Cheers

 Markus

---------------------------------------- 
If you want to unsubscribe from GRASS Development Team mailing list write to:
minordomo at geog.uni-hannover.de with
subject 'unsubscribe grass5'



More information about the grass-dev mailing list