darsh123 has asked for the wisdom of the Perl Monks concerning the following question:
And the Script is mentioned below:shell.pl" 59 lines, 1470 characters daahpdev: dev/home/rvaishna$ perl shell.pl Scalar found where operator expected at shell.pl line 46, at end of li +ne (Missing operator before ?) syntax error at shell.pl line 46, near ") $FSUSED " Unmatched right bracket at shell.pl line 59, at end of line syntax error at shell.pl line 59, near "}" Execution of shell.pl aborted due to compilation errors.
$SYS_NAME=`uname -s`; if ($SYS_NAME =~ "AIX") { $SYS_TYPE=1; `/usr/bin/df -k | /usr/bin/sort +6 >$FILE`; } elsif ($SYS_NAME =~ "HP-UX") { $SYS_TYPE=2; `/usr/bin/bdf -i >$FILE`; } elsif ($SYS_NAME =~ "Linux") { $SYS_TYPE=3; `/bin/df -kP >$FILE`; } else { print "Unknown system: $SYS_NAME."; exit -1; } open (DF, $FILE) || die "Can't Open File: $FILE\n"; while (defined ($_ = <DF> )){ ################################################################### +######## # AIX ################################################################### +######## if ($SYS_TYPE == 1){ ($FS, $BLOCKS, $FSFREE, $FSUSED, $IUSED, $PIUSED, $MOUNT) = spli +t; $FSUSED=~s/([0-9])\%/$1/; $PIUSED=~s/([0-9])\%/$1/; } ################################################################### +######## # Every OS ################################################################### +######## if ($MOUNT eq "\/") { $FS = "Root" } elsif ($FS=~/:/) { $FS1 = "NFS from " . $FS; $FS=$FS1 } if ($FSUSED >= 90) $FSUSED = "*$FSUSED*"; } if ($PIUSED > 60) { $PIUSED = "*$PIUSED*"; } if ($BLOCKS ne "Size (MB)") { $BLOCKS /= 1024 }; if ($FSFREE ne "Free (MB)") { $FSFREE = int ($FSFREE /= 1024) }; if ( (not $MOUNT=~"\/u\/") && (not $MOUNT=~"Mounted") || ($FS=~"NFS +") ) { printf "%-38s %-9d %-9d %-7s %-7s %-11s\n",$MOUNT, $BLOCKS, $FSF +REE, $FSUSED, $PIUSED, $FS; } }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Newbee to Perl and the error
by ELISHEVA (Prior) on Dec 25, 2010 at 21:09 UTC | |
|
Re: Newbee to Perl and the error
by eyepopslikeamosquito (Archbishop) on Dec 26, 2010 at 00:28 UTC | |
|
Re: Newbee to Perl and the error
by morgon (Priest) on Dec 26, 2010 at 01:27 UTC | |
|
Re: Newbee to Perl and the error
by Anonymous Monk on Dec 25, 2010 at 21:04 UTC |