Switch Problem

Switch Problem

Post by Lekeas G » Wed, 25 Jul 2001 03:06:45



Hi All,

I am having a problem with a small script I wrote to overcome the problem
of beign able to check for presence of email in my account while  logging
on to different servers of the same network. The plan is to issue a rsh
command every time I log on to a server different that the one I have my
home account set up and as the command to be executed to give the name of
the script. The script I wrote for this purpose is as follows:

/bin/mail -e
switch($status)
case 0:
        echo "You have new email."
        breaksw;
case 1:
        echo "You have mail."
        breaksw;
endsw

I tried it but it comes up with an error message saying unexpected switch
statement. I am using tcsh on a Sun 5 machine. Does anyone have any
suggestion?

Thanks in advance.

George

 
 
 

Switch Problem

Post by Keith Thompso » Thu, 26 Jul 2001 13:18:20



> I am having a problem with a small script I wrote to overcome the problem
> of beign able to check for presence of email in my account while  logging
> on to different servers of the same network. The plan is to issue a rsh
> command every time I log on to a server different that the one I have my
> home account set up and as the command to be executed to give the name of
> the script. The script I wrote for this purpose is as follows:

> /bin/mail -e
> switch($status)
> case 0:
>    echo "You have new email."
>    breaksw;
> case 1:
>    echo "You have mail."
>    breaksw;
> endsw

> I tried it but it comes up with an error message saying unexpected switch
> statement. I am using tcsh on a Sun 5 machine. Does anyone have any
> suggestion?

No, you're probably not using tcsh.  Unless you have a "#!" line at
the top of your script, it will probably be executed using /bin/sh
(actually, I think that varies depending your interactive shell).

Since you're not using any tcsh features in this script, I suggest
using

#!/bin/csh -f

as the first line.

You should also check the man page for /bin/mail.  An exit status of 0
says you have mail; an exit status of 1 says you don't.  It doesn't
distinguish between "you have mail" and "you have new mail".

(Some of us belong to so many mailing lists that we use a different
command to check whether we have new mail: /bin/true.)

--

San Diego Supercomputer Center           <*>  <http://www.sdsc.edu/~kst>
Cxiuj via bazo apartenas ni.

 
 
 

1. Unix problem or switch problem?

I have one big, probably dumb question.  We have an accelar 1200 switch with
7 IP vlans and 1 protocol based vlan.  We are using the 172.16.X subnetted
using 255.255.252.0 mask.  There is an old thicknet network in place with
mostly all unix servers attached to them using addresses of 97.0.0.x.  Our
routing table in the switch is fine - it shows all routes for all vlans.
The one unix box is sometimes dropping connection for no apparent reason.
No other unix box is having problems.  The unix guysreplaced the nic card
and things imporved and we upgraded our switch to aru2 with 1.3.4 software.
The routing is done inside the switch between the 97 and 172 networks.

Does anybody have any clues as to what to look at?


PS Remove the XXX
Thanks.

2. Sony CDU31a on Gateway

3. dual nic's and d-link switch problems

4. Y2K + Linux?

5. Solaris and ethernet switch problems

6. Bad screen resolution on AGP G4 using yaboot

7. IOGEAR kvm switch problem

8. Xconfigurator Seg Fault

9. Data Switch problems in X-Windows

10. VC switching problem with X

11. KVM USB switch problems with RH 7.2

12. 4.0 upgrade - ata driver switch problem

13. Virtual Console Switch Problems