![]() |
|
|
|
|
|||||||
| Forums | Portal | Register | Forum Rules | FAQ | Contribute | Members List | Arcade | Search | Today's Posts | Mark Forums Read |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts here. |
|
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Check space utilization in recursive mode | sureshg_sampat | Shell Programming and Scripting | 1 | 06-02-2008 10:56 AM |
| Please help - disk space check script | maddhadder71 | Shell Programming and Scripting | 0 | 05-08-2008 05:16 AM |
| Creating a shell script to check filesystem space | heprox | AIX | 10 | 06-18-2006 07:07 PM |
| pageing space vs swap space | VeroL | UNIX for Dummies Questions & Answers | 1 | 01-22-2004 08:54 AM |
| Check directory space? | lesstjm | Shell Programming and Scripting | 3 | 04-19-2002 06:10 AM |
|
|
Submit Tools | LinkBack | Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
check space !!!
The have written the below script :-
============================ SPACE=`bdf /DATA_TRANSFER|awk '{print $4}' |grep "%"` TEST="96%" if [ "$SPACE" < "$TEST" ] then echo "Continue ....." sleep 2 else echo " Current space for DATA_TRANSFER is less than 02 %" echo " Pls clear space and than continue ....." sleep 3 exit 1 fi but after execution it give's following error:- ================================ + ./checkspace[4]: 96%: cannot open I am running the same on HP-UX 11.11 version and in ksh shell. Can you assist in resolving the same ? |
| Forum Sponsor | ||
|
|
|
#2
|
||||
|
||||
|
not tested........
Code:
#!/bin/ksh
typeset -i SPACE=$(nawk '/%/{print substr($4, 1, length($4)-1)}' bdf/DATA_TRANSFER)
typeset -i TEST="96"
if (( $SPACE < $TEST ))
then
........
|
|
#3
|
||||
|
||||
|
You can't do stuff like:
if [ "$SPACE" < "$TEST" ] At least not sensibly. " < $TEST" is used to redirect the input of the test command to the file called $TEST. Since test does not use an input file, this does nothing. This is one of several dozen reason why you should switch to: if [[ whatever ]] Not only would < do what you wanted it to, but then you no longer need the quotes around the variables. |
||||
| Google The UNIX and Linux Forums |