#!/bin/csh # Sample .cshrc for U-M Particle Theory group accounts # Department of Physics, University of Michigan, Ann Arbor # @(#) $Id: sample.cshrc,v 3.10 1999/09/26 18:47:42 myers Exp myers $ ####################################################################### # The .cshrc file is started whenever you start a new csh shell. # This one does the following: # # (1) sets personalized environment informaion (name and printer) # (2) set the path variable so that commands can be found # (3) sets other useful environment variables # (4) defines useful command aliases # (5) makes adjustments for different flavours of Unix. # ####################################################################### ## @(#) 1) Personal/Custom information: (see also `chfn` to change NAME) setenv ORGANIZATION "Department of Physics, University of Michigan" setenv LPDEST monojet # SYSV (HP-UX) setenv PRINTER monojet # BSD (Linux,NeXT) setenv WWW_HOME http://feynman.physics.lsa.umich.edu/ ####################################################################### ## @(#) 2) Path: try to cover all bases for a variety of machines. # General User: if you are worried about security you may want to # remove "." from the path, or put it last instead of first. # General User: if you are worried about security you may want to # remove "." from the path, or at least put it last instead of first. # If "/" is your $HOME then assume you are root and omit . and /bin if ( "$HOME" != "/" ) then set path=( . ~/bin /usr/local/bin /usr/local/gnu/bin ) else set path=( /usr/local/bin /usr/local/gnu/bin ) endif ## University of Michigan ITD/CAEN paths: if ( -d /usr/um/bin ) set path = ( $path /usr/um/bin /usr/um/gnu/bin ) if ( -d /usr/itd/bin ) set path = ( $path /usr/itd/bin /usr/vice/bin ) ## X-window system stuff if ( -d /usr/local/X11 ) set path = ( $path /usr/local/X11 ) if ( -d /usr/X11R6/bin ) set path = ( $path /usr/X11R6/bin ) if ( -d /usr/X11R5 ) set path = ( $path /usr/X11R5 ) if ( -d /usr/bin/X11 ) set path = ( $path /usr/bin/X11 ) ## BSD if it exists: if ( -d /usr/ucb ) set path=( $path /usr/ucb ) # BSD on Sun if ( -d /usr/bsd ) set path=( $path /usr/bsd ) # BSD support on SGI set path=( $path /usr/bin /bin ) # standard stuff # SYSV if it exists: if ( -d /usr/local/sbin ) set path=( $path /usr/local/sbin ) # Linux if ( -d /usr/sbin ) set path=( $path /usr/sbin ) # SYSV system binaries # Assorted specialized directories: if ( -d /usr/lib/teTeX/bin ) set path=( $path /usr/lib/teTeX/bin ) # teTeX if ( -d /opt/ansic/bin ) set path=( $path /opt/ansic/bin ) # HP ANSI C if ( -d /opt/SUNWspro/bin ) set path=( $path /opt/SUNWspro/bin ) # Solaris if ( -d /usr/5bin ) set path=( $path /usr/5bin ) # SunOS SYSV support if ( -d /usr/ccs/bin ) set path=( $path /usr/ccs/bin ) # Solaris/HP C compiler if ( -d /usr/games ) set path=( $path /usr/games ) # BSD games ########################### ## @(#) 2b) Man Path: places to look for man pages ## (You can omit trailing man or share/man) set MANLIST=( /usr/local/gnu/man /usr/local/man /usr/man /usr/share/man ) set MANLIST=( $MANLIST /usr/X11R6/man /usr/X11R6/LessTif/doc/man ) set MANLIST=( $MANLIST /opt/fortran /opt/ansic /opt/imake /opt/lrom ) set MANLIST=( $MANLIST /usr/lang/man /usr/openwin/man /usr/lib/teTeX/man/ ) setenv MANPATH "$HOME/man" foreach MANDIR ( $MANLIST ) if ( "$MANDIR:t" != "man" ) then if ( -d $MANDIR/man ) then set MANDIR = "$MANDIR/man" else if ( -d $MANDIR/share/man ) then set MANDIR = "$MANDIR/share/man" endif endif if ( -d $MANDIR ) setenv MANPATH "${MANPATH}:${MANDIR}" end unset MANLIST MANDIR ####################################################################### ## @(#) 3) Environment: ## Make sure $user, $USER, and $mail are set, even on "dumb" systems. if ( ! $?user ) set user=`/bin/whoami` if ( ! $?USER ) then setenv USER=`/bin/whoami` endif ## If this is an rsh shell we need a "dumb" terminal type: if ( $?TERM == 0 ) setenv TERM dumb ## These are useful even for a noninteractive shell: setenv TMPDIR /tmp # default temp space if ( -d $HOME/tmp ) setenv TMPDIR $HOME/tmp # personal temp space setenv TAPE /dev/rmt/0mnb # default tape drive (HP) if ( -r /dev/nrst0 ) setenv TAPE /dev/nrst0 # Sun/NeXT by default ## If this is not an interactive shell then we are done. if ($?prompt == 0) exit 0 ########## ## Set up Interactive Environment: umask 022 # default is group/world readable set notify # notify me of job changes set ignoreeof # prevent accidental ^D logout set history=100 savehistory=20 # command history limit coredumpsize 0k # no core dumps! set shell=/bin/csh # csh for subshells even if using tcsh setenv SHELL /bin/csh # for subshells (not tcsh!) setenv PPR "enscript -p- -2rG -TUS -L66 " # how to `print` setenv VDEVICE X11 # VOGL graphics device setenv TRNINIT $HOME/.trnrc # startup for trn setenv EDITOR emacs setenv VISUAL vi ########## ## Put current directory in csh prompt: set prompt="% " set X = `hostname | tr . ' ' ` ; set X = $X[1] setenv HOST $X; unset X alias setprompt 'set prompt="${HOST}:$cwd:t> "' if ( `whoami` == "root") alias setprompt 'set prompt="${HOST}:$cwd:t# " ' if ( $TERM == "emacs" || $TERM == "unknown" || $TERM == "dumb" ) \ alias setprompt set prompt=\"% \" alias cd 'cd \!* ; setprompt' alias pd 'pushd \!* ; setprompt ' alias pop 'popd \!* ; setprompt' setprompt ####################################################################### ## @(#) 4) Command Aliases: alias ls ls -F # -F show executabls and links alias dirf 'ls -ltFg \!* | more ' # full directory listing alias rm rm -i # some protection alias mv mv -i # some more protection alias cp cp -i # even more protection alias cx chmod +x # to make a file executable alias cw chmod +w # to make a file writeable alias hide chmod go-rwx # to hide files alias unhide chmod go+r # to make files public alias msgs msgs -p # msgs uses more to page alias lo logout alias h history alias c clear alias gs gs -q # ghostscript should be seen, not heard alias gv ghostview alias screen 'screen -fn -R' alias rlast 'rsh -n \!^ last \!:2* | more' alias mfinger 'finger `awk '\'' /^alias/ { if ( $2 == name ) {for (i = 3; i <= NF; ++i) print $i }} '\'' name=\!* ~/.mailrc`' alias psgrep 'ps -aux | grep \!* | grep -v grep' alias ffind 'find . -name "*\!{^}*" \!:2* -print ' # find a file alias du-s 'du -s \* \| sort -n' ## Alias these commands only if real ones are/aren't there if ( -x /usr/local/bin/mush ) then alias mail mush alias todo mush -f +TODO endif if ( ! -x /usr/local/bin/info) then alias info emacs -f -info endif ## autologout root shells quickly, others slowly if ( `whoami` == "root") then set autologout = 60 else set autologout = 480 endif ########## ## VMS command synonyms (can't hurt, might help): alias dir ls alias copy cp -i alias delete rm -i alias type cat alias rename mv -i alias fort f77 ####################################################################### ## @(#) 5) Different Flavours of Unix: set UNAME = "unknown" if ( -x /bin/uname ) set UNAME = `/bin/uname` if ( -x /usr/bin/uname ) set UNAME = `/usr/bin/uname` if ( -x /usr/local/bin/uname ) set UNAME = `/usr/local/bin/uname` ############# ## NeXTSTep/mach: if ( -f /sdmach ) then set path=( $path ~/Apps /LocalApps /NextApps /NextDeveloper/Demos ) alias lpq lpq -P\$PRINTER # dumb NeXT! alias lpr lpr -P\$PRINTER # dumb NeXT! if ( "$UNAME" == "unknown" ) alias uname echo NEXTSTEP set UNAME = NEXTSTEP alias rlast 'rsh \!^ -n last \!:2* | more' setenv TAPE /dev/nrst0 # System Administrator or superuser on NeXT if ( "`groups | grep adm`" != "" ) then set path=( $path /etc /usr/etc /NextAdmin ) endif if ( "$user" == "root") then set path= ( /NextAdmin /usr/etc /etc $path ) # dot not first! unset ignoreeof endif endif ############# ## HP-UX 9.x or 10.X if ( -f /hp-ux || -f /stand/vmunix && "$UNAME" == "HP-UX" ) then set path=( $path /usr/contrib/bin /usr/contrib/bin/X11 ) if ( -d /opt/ansic/bin ) set path=( $path /opt/ansic/bin ) # HP ANSI C alias ps5 'top -d1 -n5' alias psgrep 'ps -ef | grep \!* | grep -v grep' alias dirf 'ls -tlF \!* | more ' # full directory listing alias rgrep 'find . -xdev -type f -print -exec grep "\!*" {} \; ' if ( ! -x /usr/bin/lpr ) alias lpr lp -d\${LPDEST} alias lpq lpstat \${LPDEST} alias atq at -l alias atrm at -r alias last last -R alias who who -R if ( -x /usr/bin/remsh && ! -x /usr/local/bin/rsh ) then alias rsh /usr/bin/remsh endif # System Administrator or superuser: if ( "`groups | grep adm`" != "" || `whoami` == "root") then set path=( $path /sbin /usr/sbin /usr/etc ) endif if ( `whoami` == "root") then set path=`echo $path | sed -e "s/\. //"` # Remove 'dot' from path unset ignoreeof endif endif ############# ## SunOS 4.x: if ( -f /vmunix && "$UNAME" == "SunOS" ) then alias ps5 'ps -auxg | head -6 ' setenv TAPE /dev/nrst0 if ( "`groups | egrep 'adm|operator'`" != "" ) then set path= ( $path /usr/etc ) endif endif ############# ## Solaris (SunOS 5.x): if ( -f /kernel/genunix && "$UNAME" == "SunOS" ) then set path=( $path /usr/openwin/bin/ ) alias ps5 'ps -auxg | head -6 ' alias psgrep 'ps -aux | grep \!* | grep -v grep' alias dirf 'ls -tlFg \!* | more ' # full directory listing setenv TAPE /dev/rmt/0mnb endif ############# ## Linux if ( "$UNAME" == "Linux" ) then setenv TAPE /dev/fd0 # tar defaults to floppy drive eval `dircolors -c` alias dirf 'ls -ltFg --color=always \!* | less -EXr ' alias psgrep 'ps aux | grep \!* | grep -v grep' if ( -x /usr/info) unalias info if ( "`groups | grep adm `" != "" || `whoami` == "root") then set path=( $path /usr/local/adm /sbin /usr/sbin ) endif endif exit 0