g.man, g.cp, etc

mike camann camann at pick.uga.edu
Wed Jun 30 16:05:15 EDT 1993


	>mccauley at ecn.purdue.eduwrites on Wed Jun 30 17:14:58 1993

	>> (btw, does anyone else think that "g.manual" a little long
	for a
	>> command name? :-)
	>>
	>> --Darrell
	>>

	>Not just too long, I like g.man better because it sounds unix.
	A lot of
	>students I teach are novices to GRASS and UNIX. I think they
	learn faster
	>if things are more consistent. So how about g.rm, g.cp instead
	of
	>g.remove, g.copy, etc.? It would really be great if the
	horrible
	>``option=name1,name2'' command line arguments would replaced
	for
	>unix syntax.

	>Raymond Venneker - Inst. of Earth Sc., Free University
	Amsterdam


Good idea!  If you use csh or tcsh, add the lines:

    echo "alias g.man g.manual" >> $cshrc
    echo "alias g.rm g.remove" >> $cshrc
    echo "alias g.cp g.copy" >> $cshrc

to the file $GISBASE/etc/GIS.sh in the csh|tcsh alternative to the case
"$sh" statement.  Is that clear as mud?  Here's what I mean:

case "$sh" in

csh|tcsh)
    HOME=$LOCATION
    export HOME
    cshrc=$HOME/.cshrc
    tcshrc=$HOME/.tcshrc
    rm -f $cshrc $tcshrc
    echo "set home = $home" > $cshrc
    echo "set history = 30 noclobber ignoreeof" >> $cshrc

    echo "set prompt = '\\" >> $cshrc
    echo "Mapset <${MAPSET}> in Location <${LOCATION_NAME}> \\" >>
    $cshrc
    echo "GRASS 4.1 > '" >> $cshrc
    echo 'set BOGUS=``;unset BOGUS' >> $cshrc

    if [ -r $home/.grass.cshrc ]
    then
	cat $home/.grass.cshrc >> $cshrc
    fi

    if [ -r $home/.cshrc ]
    then
	grep '^ *set  *mail *= *' $home/.cshrc >> $cshrc
    fi

    if [ -r $home/.tcshrc ]
    then
	grep '^ *set  *mail *= *' $home/.tcshrc >> $cshrc
    fi

    if [ -r $home/.login ]
    then
	grep '^ *set  *mail *= *' $home/.login >> $cshrc
    fi

    echo "set path = ( $PATH ) " | sed 's/:/ /'g >> $cshrc

>    ##########################################################
<
>    #  Added by M. Camann 930630
<
>    ##########################################################
<
>    echo "alias g.man g.manual" >> $cshrc
<
>    echo "alias g.rm g.remove" >> $cshrc
<
>    echo "alias g.cp g.copy" >> $cshrc
<

    cp $cshrc $tcshrc
    $ETC/run $SHELL

    HOME=$home
    export HOME
    ;;

*)

	This will give you g.man, g.cp, and g.rm, though the options
	still do not adhere to unix conventions.  You _could_ write
	shell scripts instead of simply using aliases and pass their
	arguments according to unix conventions without too much
	difficulty.  Needless to say, you need write permission in
	$GISBASE/etc/GIS.sh in order to add the lines above.
	Of course, if you use some other shell, you'll have to modify
	the command accordingly.


Mike Camann
camann at dial.pick.uga.edu



More information about the grass-dev mailing list