The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

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 and shell scripting languages 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 01:56 PM
Please help - disk space check script maddhadder71 Shell Programming and Scripting 0 05-08-2008 08:16 AM
Creating a shell script to check filesystem space heprox AIX 10 06-18-2006 10:07 PM
pageing space vs swap space VeroL UNIX for Dummies Questions & Answers 1 01-22-2004 11:54 AM
Check directory space? lesstjm Shell Programming and Scripting 3 04-19-2002 09:10 AM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 11-09-2005
kamlesh_p kamlesh_p is offline
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 ?
  #2 (permalink)  
Old 11-09-2005
vgersh99's Avatar
vgersh99 vgersh99 is online now Forum Staff  
Moderator
  
 

Join Date: Feb 2005
Location: Boston, MA
Posts: 5,119
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 (permalink)  
Old 11-09-2005
Perderabo's Avatar
Perderabo Perderabo is offline Forum Staff  
Unix Daemon
  
 

Join Date: Aug 2001
Location: Ashburn, Virginia
Posts: 9,111
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.
Sponsored Links
Closed Thread

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 07:56 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0