Visit Jeremy's Blog.
Go Back > Forums > Linux Forums > Linux - Newbie
User Name
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!


  Search this Thread
Old 06-11-2008, 02:18 AM   #1
LQ Newbie
Registered: Jun 2008
Posts: 18

Rep: Reputation: 0
Issue with Script??

root@testdb /]# cat /u01/BACKUP/scripts/
# This script can be used to
# warn the users that
# the file system is getting full
# Script needs adjusted for your
# needs. Below is set to monitor
# all the file systems mounted and report to
# Usage: as a cron entry for best use.

for fs in `df -k|awk '{print $1}'|sed -n "3,14 p"`
x=`df -kl | grep $fs | awk '{ print $5 }'`

if [ $x -gt $y ]
message="File System `df -k |grep $fs |awk '{print $6\",\"$5}'` Full!!!"
echo $subject
echo $message | mailx -s "`hostname` - File System Full
Warning !!!" $RECEIVER
[root@testdb /]#

[root@testdb /]# ./u01/BACKUP/scripts/
./u01/BACKUP/scripts/ line 21: [: 12%: integer expression expected
./u01/BACKUP/scripts/ line 21: [: 0%: integer expression expected
./u01/BACKUP/scripts/ line 21: [: 2%: integer expression expected
./u01/BACKUP/scripts/ line 21: [: 96%: integer expression expected
./u01/BACKUP/scripts/ line 21: [: 91%: integer expression expected
[root@testdb /]#

How to i resolve this error.

Old 06-11-2008, 02:28 AM   #2
LQ Newbie
Registered: Jun 2008
Distribution: RHEL, Fedora, Gentoo, Slackware
Posts: 27

Rep: Reputation: 15
-gt expects numeric inputs. "50%" is not a numeric input, but "50" is. You need to strip the % sign out of your input before testing against it.

So, instead of:


You would use:


and to strip the % out in the x line, add a pipe to your favorite regex engine. My example uses sed:

x=`df -kl | grep $fs | awk '{ print $5 }' | sed 's/%//'`

For perl, it's identical except for the command:

x=`df -kl | grep $fs | awk '{ print $5 }' | perl -pe 's/%//'`


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Script Issue ryanbrimmer Linux - Newbie 1 06-16-2007 05:23 AM
sh script issue. UltraSoul Solaris / OpenSolaris 4 03-29-2007 05:31 PM
Simple script issue...I think chiquitomuir Linux - Newbie 4 09-22-2006 10:02 PM
Issue with my backup script gauge73 Linux - General 7 02-23-2004 08:54 PM
Script Issue gauge73 Linux - General 8 07-14-2003 09:50 AM > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 01:50 PM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration