Badly formed number.


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Badly formed number.
# 1  
Old 08-08-2008
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
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Badly placed ()'s

Edit - I don't know how to delete posts. The question I asked here ended up not being the question I should have asked as I didn't realise I needed to edit my script to comply with SGE. Hi, My script is: #!/bin/bash # Perform fastqc on files in a specified directory. for ((j=1;... (8 Replies)
Discussion started by: una1992
8 Replies

2. Programming

Badly places ()'s on C

I dont know why this Linux would give me badly placed () error all the time for this; #include <stdio.h> int main() { register int num=0 ; while ((num < 5)) ++num; printf("Pass %d \n", num) ; return 0 ; } can anyone help me please? (11 Replies)
Discussion started by: sizzler786
11 Replies

3. Shell Programming and Scripting

Badly Placed ()'s when trying to use csh

The terminal is bash. Whenever I try to execute csh just by itself it gives Badly Placed ()'s. Whenever I try to use csh with a script it also gives Badly Placed ()'s. My script is this, there is nothing wrong with it, since it used by other students in class as well. (I have also asked... (5 Replies)
Discussion started by: quantumizer
5 Replies

4. Shell Programming and Scripting

tcsh: not run script (if: Badly formed number)

Hello I have Linux Debian & tcsh shell. My mini script not run :(. Startup script displays a message: user@host:dir% ./test if: Badly formed number. script: #!/bin/tcsh -f #script check size files systems set x = `df -h /usr | tail -n1 | awk '{ print( $5 ); }'` set y = 60% if ($x... (5 Replies)
Discussion started by: moskovets
5 Replies

5. Shell Programming and Scripting

history: Badly formed number

% history clean history: Badly formed number. :( % echo $0 /usr/local/bin/tcsh % uname SunOS % grep -e "hist" .tcshrc.user set history=90 set savehist=80 Please suggest what could be the problem here. Thanks in advance. (1 Reply)
Discussion started by: mayankmehta_83
1 Replies

6. Shell Programming and Scripting

Unix XML Parsing check well formed

Hi, I am using ksh, is there any command which can check whether the XML file is well formed or not? Regards, Sreejit (1 Reply)
Discussion started by: sreejitnair123
1 Replies

7. Shell Programming and Scripting

badly placed ()'s

i'm trying to run the following program but i keep getting the message "badly placed ()'s" can u help? #include "modularity_mat.h" #include "../sparse_mlpl/sparse_matrix.h" adj_matrix_arr* allocate_mem_for_matrix_arr (int y) { /* Create the adj matrix and allocate memory */ ... (2 Replies)
Discussion started by: ronirosner
2 Replies

8. UNIX for Dummies Questions & Answers

Need Help Badly: Newbie Here

I have this file: NPANXX|BILLDATE|DIVCODE|COMID|RAO|LIKECODE|BOSS|SORD|STATECODE| 087001|BP01|H|SWBT| |041|IMR6|IMSR6|AR| 087002|BP03|H|SWBT| |042|IMR6|IMSR6|AR| 087003|BP05|H|SWBT| |043|IMR6|IMSR6|AR| .... these are the things that i HAve to do: Insert a new column named “TEST” All... (14 Replies)
Discussion started by: arkhei
14 Replies

9. Shell Programming and Scripting

for:badly formed number

Hi, I am doing the following but it complains and says "for:badly formed number" does anyone know why? #!/bin/tcsh foreach(....) ............ set depth=64 set width=23 if ($depth==64) then echo "if" set addr_bits=5 else echo "else" endif echo "addr_bits:$addr_bits" echo... (3 Replies)
Discussion started by: ROOZ
3 Replies

10. Shell Programming and Scripting

Badly placed ()'s. - error

Hi, when I execute the below script, I am getting following error "Badly placed ()'s". can anyone please help me fix ---------------------------------------------------------- # Usage: ani -n -a -s -w -d # # # help_ani() To print help # help_ani() { echo "Usage: $0 -n -a -s -w -d"... (3 Replies)
Discussion started by: amitrajvarma
3 Replies
Login or Register to Ask a Question