AIX 6.1 Error: 0403-053 Expression is not complete; more tokens expected.


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting AIX 6.1 Error: 0403-053 Expression is not complete; more tokens expected.
# 1  
Old 05-13-2013
AIX 6.1 Error: 0403-053 Expression is not complete; more tokens expected.

Hi
I have been trying every possible solution available for this error on this Forum but could not resolve it.

When i am running the below script i get this error.Smilie

sh diskMonitor.sh
diskMonitor.sh[23]: -: 0403-053 Expression is not complete; more tokens expected.
diskMonitor.sh[23]: -: 0403-053 Expression is not complete; more tokens expected.

The Verison of Unix is : AIX 6.1

The Script is to monitor disk space and send alert mail.

Code is :

Code:
#!/usr/bin/ksh
#This script monitors available disk space.
# This script emails an alert when a locally mounted partition crosses a given threshold.
# Set your threshold percentage (do not include the % sign), email address, and excluded mount points, then add to crontab
#
# Add this to crontab -e for root
# Diskspace monitoring script
#0 6 * * 1-5 /bin/diskMonitor.sh >/dev/null 2>&1

THRESHOLD="99"
EMAIL="abe@atred.com"
HOSTNAME=`hostname`

# Excluded mount points *must* be pipe delimited
# "/proc|/export/home|Mounted" should always be included

EXCLUDE="/proc|/export/home|Mounted"

df -k | awk '{print $7"\t"$4}' |egrep -v "(${EXCLUDE})" | while read LINE; do
PERC=`echo $LINE |awk '{print $2}' | cut -d"%" -f1`
Path=`echo $LINE |awk '{print $1}'`

if [ $PERC -gt THRESHOLD ];
then
echo "*****ALERT on $HOSTNAME Disk Space Exceeded the Threashold.Current Usage is  ${PERC}% on path  ${Path} Please perform C
lean Up*****" | /usr/bin/mailx -r xrt@avft.com -s "ALERT `hostname`: Disk Space Alert: ${LINE} used " $EMAIL
fi
done

---------- Post updated at 04:32 AM ---------- Previous update was at 04:26 AM ----------

FYI

The Script is working and sending mail. Its doing what it should but with these two o/p error message which i want to get rid of ASAP so i can cron them.

Last edited by Franklin52; 05-13-2013 at 07:34 AM.. Reason: Please use code tags for data and code samples
# 2  
Old 05-13-2013
First you have a missing $ in if
second what done $PERC holds?

if [ $PERC -gt $THRESHOLD ] ;
# 3  
Old 05-13-2013
No, That is not the issue.
It was a typo.
There is a $ in THRESHOLD vairable.
and $PERC hold the Percentage used by the file system
# 4  
Old 05-13-2013
Try to use variable names in small case letters as uppercase might lead into some shell internal variable and throw error like THRESHHOLD.. (I may not be 100% correct here worth a try)
# 5  
Old 05-13-2013
Hi,

Use quote when you compare variables in case one is empty;

So use :
Quote:
if [ "$PERC" -gt "$THRESHOLD" ];
# 6  
Old 05-13-2013
Thanks for reply. But it didnt help. I tired that too
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

0403-057 Syntax error at line 17 : `(' is not expected.

Hi, While executing my code i am getting below Error: ./check_disk1: 0403-057 Syntax error at line 55 : `(' is not expected. My code is : #!/bin/ksh PROGNAME=`basename $0` STATE_OK=0 STATE_WARNING=1 STATE_CRITICAL=2 STATE_UNKNOWN=3 OS=$(uname) AWK="/usr/bin/awk"... (6 Replies)
Discussion started by: abodage
6 Replies

2. Shell Programming and Scripting

Getting error -: more tokens expected in shell script

Hi can someone help me to resolve the error for this condition if ] && ]; then i am passing the values $k and $kkm i am getting the error like "-: more tokens expected" Thanks in Advance (5 Replies)
Discussion started by: makigate
5 Replies

3. AIX

0403-057 Syntax error at line 17 : `(' is not expected.

Hi, I am new to shell scripting.i am trying to mail after my backup completed. Here is my shell script: if ; then egrep (ERROR|error|Error|RMAN-) ${/backup/RMANBKUP/spool/shelltest.log} > /dev/null if ; then RESULT_MSG=WARNING: Errors occurred during the ${ORACLE_SID} Rman... (3 Replies)
Discussion started by: faruqms
3 Replies

4. Shell Programming and Scripting

0403-057 Syntax error at line : `}' is not expected.

i dont know where m i mistaking.. please help me out with this issue :( thanks in advance:rolleyes: one_main() { a=100 while ; do clear echo "##############################################" echo ":: CURRENTLY YOU ARE IN RC AND OC MARKING ::" echo... (1 Reply)
Discussion started by: Puneet sinha
1 Replies

5. Shell Programming and Scripting

ksh: 0403-057 Syntax error: `done' is not expected.

Hi I am getting error 'ksh: 0403-057 Syntax error: `done' is not expected.' when running below script any one can provide inputs on this. ------------------------ if then echo "Report Name |Modification Date|Report File Size|Owner" >SOX_`date +'%Y%m%d'` while read line do... (2 Replies)
Discussion started by: karnatis
2 Replies

6. Shell Programming and Scripting

+: more tokens expected

Hey everyone, i needed some help with this one. We move into a new file system (which should be the same as the previous one, other than the name directory has changed) and the script worked fine in the old file system and not the new. I'm trying to add the results from one with another but i'm... (4 Replies)
Discussion started by: senormarquez
4 Replies

7. Shell Programming and Scripting

Receiving error: ./ang.ksh[35]: 0403-057 Syntax error at line 116 : `done' is not expected.

Hi All I am quite new to Unix. Following is a shell script that i have written and getting the subject mentioned error. #!/bin/ksh #------------------------------------------------------------------------- # File: ang_stdnld.ksh # # Desc: UNIX shell script to extract Store information.... (3 Replies)
Discussion started by: amitsinha
3 Replies

8. Shell Programming and Scripting

Script - Expression not complete more tokens expected

I have the following script to output a report of response times - but it is throwing the error: ./jobname: -: 0403-053 Expression is not complete; more tokens expected. Here is the code, any ideas what the problem is? (line 46 is simply, LC=0) FILE2=/templogs/access_log... (9 Replies)
Discussion started by: daveaasmith
9 Replies

9. Shell Programming and Scripting

0403-057 Syntax error at line 52 : `)' is not expected.

Can someone please tell me wht is wrong with the following peice of code? I keep getting the following error - 0403-057 Syntax error at line 52 : `)' is not expected. case "${option_count}" in 1) java -Xms256m -Xmx1536m "${APPLNAME}" "${ACTION_TYPE}" > "${LOGFILE}" 2>... (2 Replies)
Discussion started by: Veenak15
2 Replies

10. Shell Programming and Scripting

: + : more tokens expected

Hello- Trying to add two numbers in a ksh shell scripts and i get this error every time I execute stat1_ex.ksh: + : more tokens expected stat1=`cat .stat1a.tmp | cut -f2 -d" "` stat2=`cat .stat2a.tmp | cut -f2 -d" "` j=$(($stat1 + $stat2)) # < Here a the like the errors out echo $j... (3 Replies)
Discussion started by: Nomaad
3 Replies
Login or Register to Ask a Question

Featured Tech Videos