Xref: utzoo comp.unix.programmer:612 comp.unix.shell:1018 comp.unix.questions:27350 Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!uunet!munnari.oz.au!bruce!trlluna!shiva!hui From: hui@shiva.trl.oz (Alvaro Hui) Newsgroups: comp.unix.programmer,comp.unix.shell,comp.unix.questions Subject: how to check mail remotely : Summary Message-ID: <2517@trlluna.trl.oz> Date: 4 Dec 90 04:31:07 GMT Sender: news@trlluna.trl.oz Lines: 70 Hi, I post a question a few days ago asking how to check mail remotely without logging in to the machine, here are the responses: Unfortunately, only two of them.... BUT they all works fine for me! Thanks Gordon and Matt for their response! Enjoy! ======================================================================== From: ping!gorpong@uu.psi.com (Gordon C. Galligher) One way is: 'rsh host ls -l /usr/spool/mail/myname' This will give you a listing of the directory. It would be nice to do: rsh host mail -e Which (if -e is supported) would cause 'mail' to exit with a non-zero exit status if you have mail, but rsh is brain-dead. It only returns an exit status of non-zero if it could not make a connection, it does not let you know the exit status of your remote command. You could, however embedd this, thus (NOTE: these are one-line things, the '\' is for readability): SH/KSH: status=`rsh host /bin/sh -c '(if test -s /usr/spool/mail/myname ; \ echo 1 ; else echo 0 ; fi)'` if [ $status -eq 1 ] ; then echo 'You have mail on host' ; fi CSH: set stat = `rsh ...same as above...` if ( $stat == "1" ) echo "You have mail on hosts" Other than logging in, there is no other way. If you are using NFS, and the rexd program is enabled, then you can replace the 'rsh' above with the 'on' command. The 'on' command is intelligent enough to have a return a status which is the same as the invoking program. Therefore: (SH/KSH): if on host mail -e ; then echo 'You have mail on host' ; fi (CSH): if ( {on host mail -e} ) echo 'You have mail on host' If, of course, you will be doing all of this from the command line, then you might as well do: rsh host from or on host from This will quickly let you know IF you have mail, and then who it is from. I hope this all helps. -- Gordon. -- Gordon C. Galligher 9127 Potter Rd. #2E Des Plaines, IL 60016-4881 ...!{uupsi,uu.psi.com}!ping!gorpong From: ma155fbd%sdcc14@ucsd.edu (Vegetable Man) Well, I'm not sure how universal it is, but with all the unix machines i've used, the mail is stored in the file /usr/spool/mail/ so you can just ftp that file, if it exists, then you not only find out about new mail, you can read it. I do that with work and school, at least. I'm not sure where VMS puts unread mail, and ftp may not be available on your DEC machines, so this is not the total answer. good luck, matt mbonner@ucsd.edu