From - Wed Dec 4 18:37:47 1996 Path: guest.unizar.es!news.unizar.es!news.rediris.es!news.belnet.be!swsbe6.switch.ch!swidir.switch.ch!nntp.coast.net!newsfeed.dacom.co.kr!usenet.kornet.nm.kr!agate!nntpfeed.doc.ic.ac.uk!sunsite.doc.ic.ac.uk!news.cc.ic.ac.uk!vulture From: vulture@imperial.ac.uk (Thomas Sippel - Dau) Newsgroups: comp.sys.sgi.admin Subject: Re: csh questions and /etc/cshrc Date: 2 Dec 1996 15:13:51 GMT Organization: Imperial College of Science, Technology and Medicine Lines: 59 Sender: vulture@carrion.cc.ic.ac.uk (Thomas Sippel - Dau) Distribution: world Message-ID: <57urnf$1mu@oban.cc.ic.ac.uk> References: Reply-To: vulture@imperial.ac.uk NNTP-Posting-Host: cscgc.cc.ic.ac.uk Originator: vulture@carrion.cc.ic.ac.uk In article , mmhall@netcom.com (Margaret M. Hall) writes: - Hello! - - I have a user who, when he logs in, the /etc/motd file is - displayed twice. I see this is the /etc/cshrc file, which is - getting sourced, (I tested this by commenting out one, then - the other cat... /etc/motd lines): - - # Print the message of the day. - cat -s /etc/motd - - if (! $?ENVONLY) then - - # Print the message of the day. - cat -s /etc/motd - echo LOOK AGAIN: $?ENVONLY - - # Check for mail. - if ( -e /bin/mail ) then - if ( { /bin/mail -e } ) then - echo 'You have mail.' - endif - endif - endif The short answer is to delete the /etc/cshrc file you showed, as it does not do anything useful. The file /etc/motd should only be displayed if it is appropriate to do so, i.e. when an interactive shell is being started. The recommended phrasing for this is: csh, tcsh: if ($?prompt) cat -s /etc/motd sh, ksh, bash: case $- in *i*) cat -s /etc/motd;; esac The phrase $?varname tests for the existence of a variable varname without aborting if it does not. The default behaviour for the decrepit C-shell is to abort when undefined variables are used (distinguish this from "variables with a NULL value") The /etc/cshrc file you show neatly disables commands like: rsh host -l luser tar -cBf - . | tar -xBf - as the luser's login shell's startup file scentmark is undigestible for the pipe reading process. Thomas -- *** Why not use metric units and get things right first time, every time. * email: cmaae47@ic.ac.uk (Thomas Sippel - Dau) * voice: +44 171 594 6904 (day), +44 171 594 6958 (fax), +44 171 385 6540 * snail: ICSTM, Computing Services, Kensington SW7 2BX, Great Britain