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 and shell scripting languages here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
call shell script from perl cgi script problem raksha.s Shell Programming and Scripting 2 03-25-2009 04:50 AM
ssh script problem problem pcjandyala Shell Programming and Scripting 2 07-31-2008 04:27 PM
FTP script and problem lawadm1 Shell Programming and Scripting 1 06-18-2007 06:44 PM
Problem starting a script from a 'main'-script Rakker UNIX for Dummies Questions & Answers 3 06-28-2005 09:12 AM
Script problem danyxti667 UNIX for Dummies Questions & Answers 2 02-11-2005 02:01 PM

 
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Bulgarian Greek Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
Prev Previous Post   Next Post Next
  #1 (permalink)  
Old 03-30-2009
mohitmoudgil mohitmoudgil is offline
Registered User
  
 

Join Date: Jan 2009
Posts: 12
Unhappy Problem with script

Hi,

I am making a shell script but getting the errors.

Script is


Code:
#!/bin/bash

ls /var/cpanel/users > /home/users.txt

for i in `cat /home/users.txt`
do


grep -H PLAN /var/cpanel/users/$i | cut -f2 -d= > /root/oldpkg.txt

oldpkg=`cat /root/oldpkg.txt`

echo "Old package is $oldpkg"


du -kcs /home/$i | cut -f1 > /root/usage.txt

usage=`cat /root/usage.txt`
echo $usage

numusage=$(`expr $usage`)

echo " usage is $numusage"


if [ "$usage" -lt 50000 ]
then
newpkg="less that 50000 k"
echo $newpkg
fi


if [ "$usage" -gt 50000 ]
then
newpkg="greater that 50000 k"
echo $newpkg 
fi

done

The output I get is


Code:
Old package is nolimit
6776 6776
expr: syntax error
 usage is 
account.sh: line 26: [: 6776
6776: integer expression expected
account.sh: line 33: [: 6776
6776: integer expression expected
Old package is nolimit
280 280
expr: syntax error
 usage is 
account.sh: line 26: [: 280
280: integer expression expected
account.sh: line 33: [: 280
280: integer expression expected
Old package is nolimit
576 576
expr: syntax error
 usage is 
account.sh: line 26: [: 576
576: integer expression expected
account.sh: line 33: [: 576
576: integer expression expected
Old package is nolimit

Please help me out.

Thanks in advance
 

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:39 AM.


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