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
sed help needed badly aliyesami Shell Programming and Scripting 6 06-27-2008 06:16 AM
for:badly formed number ROOZ Shell Programming and Scripting 3 06-05-2008 06:35 PM
tail | grep lagging badly WasabiVengeance Shell Programming and Scripting 3 04-22-2008 07:53 PM
Badly placed ()'s. - error amitrajvarma Shell Programming and Scripting 3 10-12-2007 05:40 AM
New to it all, But i wanna script really badly!!! TheNewGuy Shell Programming and Scripting 3 07-03-2004 11:33 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 08-08-2008
Northerner Northerner is offline
Registered User
  
 

Join Date: May 2008
Location: Sheffield
Posts: 11
Badly formed number.

I have the following script running every day numerous times a day and it works fine, but very occasionally I get the following error

if: Badly formed number.

Anyone know why?

Here is the script that runs with the follow parms

LCTMDBSE 100000 130000 160000


Code:
#!/bin/csh  
 
##############################
# Variables and Parameters   #
##############################
 
set JOBNAME=$0
set LOWNUM=$1
set MEDNUM=$2
set HIGHNUM=$3
 
##############################
# Validate Number of parms   #
##############################
 
if $#argv != 3 then
echo YOU MUST SUPPLY 3 PARAMETRES - LOW, MEDIUM AND HIGH VALUES 
exit 1
endif
 
###################################
# Validate Parms in correct order # 
###################################
 
if ( ( $HIGHNUM <= $MEDNUM ) || ( $HIGHNUM <= $LOWNUM ) || ( $MEDNUM <= $LOWNUM ) ) then
echo YOU MUST SUPPLY 3 PARAMETRES IN ASCENDING ORDER - LOW, MEDIUM AND HIGH VALUES
exit 2
endif
 
##############################
# Remove full path           #
##############################
 
set PATH_BREAKDOWN=`echo $JOBNAME | tr / " "`
foreach BARREL ( $PATH_BREAKDOWN )
   set REALJOBNAME=$BARREL
end
 
set JOBNAME=$REALJOBNAME
 
set  CMPROFILE=`whoami` 
 
##############################
# Run the SQL                #
##############################
 
set RESULT=`LCTMSQL count_dbase`
 
###################################
# Compare Results                 #
###################################
 
if ( "$RESULT" <= "$LOWNUM" ) then
echo Number of jobs on $CMPROFILE Database is $RESULT
echo This is classed as LOW
exit 0
endif
 
if ( "$RESULT" >= "$MEDNUM" && "$RESULT" < "$HIGHNUM" )  then 
echo Number of jobs on $CMPROFILE Database is $RESULT
echo This is classed as MEDIUM
exit 4
endif
 
if ( "$RESULT" >= "$HIGHNUM" ) then
echo Number of jobs on $CMPROFILE Database is $RESULT
echo This is classed as HIGH
exit 8
endif


Last edited by jim mcnamara; 08-08-2008 at 04:34 PM.. Reason: add code tags
 

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 04:46 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