I'm very new to perl. I have been trying to reweite some of my shell scripts to learn 
the language.  Here's what I've got...


#!/usr/local/bin/perl -w

if ( $#ARGV+1 !=2 ) {
        print "\n";
        print "usage cat.pl port up\/down\n";
        print "\n";
        exit;
}

chomp( $port = $ARGV[0] );
chomp( $ARGV[1] );

if ( $ARGV[1]=~/up/i ) { $status = 1; } elsif ( $ARGV[1]=~/down/i ) { $status=2 };

print "$status";

#if (( $status ne 1 ) || ( $status ne 2 )) {
#        print "\n";
#        print "port status must be either up or down\n";
#        print "\n";
#        exit;
#}
system("/usr/bin/snmpset hostname password 
interfaces.ifTable.ifEntry.ifAdminStatus.$port i $status");


Here is the output fro mthe script...

lunar:~/bin$ cat.pl 1 down
2
port status must be either up or down

It never makes the system call to snmpget.


The commented lines is what isn't working.  Up to "print "$status";" everything is 
fine and the appropriate status returns.  I need the script to exit if $status doesn't 
equal 1 or 2.  If $status does the ni need it to continue and make the system call to 
snmpset.

Thanks in advance,

dan

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to