James Kelty wrote: > > Hello! > > I am new to the list, so forgive me if this is not the correct forum. I am > writing (attempting to anyway) a script that will look at the size of the > filesystem, and warn me if it is getting too full, say 90% percent or so. > > Initially I though that combining the df -k output of the system with awk > would work: > > #!/usr/bin/perl > > $percent = `df -k | awk '{print $5}'`; > > chomp($percent); > chop($percent); # To get rid of the % > > if($percent > "90") { > > do something > } > > I though that this would work, but I didn't get just the % column from the > awk statment. I am really trying > to do this all in perl instead of mixing it with awk. > It's better to know what you got, instead to know what you didn't got.
However, before awk can work, perl substitues $5 with it's value (which is surely undef). So you should quote it: $percent = `df -k | awk '{print \$5}'`; or use the non-interpolation form $percent = qx'df -k | awk \'{print $5}\''; You would have recogniced it when running under use warnings, as you should always do :-) Best Wishes, Andrea -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]