The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
Google UNIX.COM


Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts here.

More UNIX and Linux Forum Topics You Might Find Helpful
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

Reply
 
Submit Tools LinkBack Thread Tools Search this Thread Display Modes
  #1  
Old 11-09-2005
Registered User
 

Join Date: Sep 2005
Posts: 9
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 ?
Reply With Quote
Forum Sponsor
  #2  
Old 11-09-2005
vgersh99's Avatar
Moderator
 

Join Date: Feb 2005
Location: Boston, MA
Posts: 3,029
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
........
Reply With Quote
  #3  
Old 11-09-2005
Perderabo's Avatar
Unix Daemon
 

Join Date: Aug 2001
Location: Washington DC Area
Posts: 8,667
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.
Reply With Quote
Google The UNIX and Linux Forums
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes




All times are GMT -7. The time now is 05:32 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited.
The UNIX and Linux Forums Content Copyright ©1993-2008. All Rights Reserved.Ad Management by RedTyger Visit The Complex Event Processing Blog

Content Relevant URLs by vBSEO 3.2.0