Help regarding Error message: A test command parameter is not valid


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Help regarding Error message: A test command parameter is not valid
# 1  
Old 06-29-2007
Help regarding Error message: A test command parameter is not valid

Hi

I am getting few messages when trying to run my script from the following lines in the script

if test [ $COLNAME -eq "BUCH_DAT" ]
then
// SomeCode
fi


The messages are as follows:

testing.sh[123]: OBLIGOR_GROUP_ID: 0403-012 A test command parameter is not valid.
testing.sh[123]: LFD_NR_B2USG: 0403-012 A test command parameter is not valid.
testing.sh[123]: TAB_ID: 0403-012 A test command parameter is not valid.
testing.sh[123]: LOAD_TIMESTAMP: 0403-012 A test command parameter is not valid.
testing.sh[123]: BUCH_DAT: 0403-012 A test command parameter is not valid.



I guess these are b'coz of some syntax problem.

Kindly correct me.


Thanks
# 2  
Old 06-29-2007
eq is used for numerical comparison
Code:
if test [ $COLNAME = "BUCH_DAT" ]

# 3  
Old 06-29-2007
Even now i am getting these messages

testing.sh[123]: COLNAME: 0403-012 A test command parameter is not valid.
0403-012 A test command parameter is not valid.
testing.sh[123]: OBLIGOR_GROUP_ID: 0403-012 A test command parameter is not valid.
testing.sh[123]: LFD_NR_B2USG: 0403-012 A test command parameter is not valid.
testing.sh[123]: TAB_ID: 0403-012 A test command parameter is not valid.


There are few more messages like this from the following code :

if [ $FLAG -eq 0 ] && [ $COLNAME != "LFD_NR_B2USG" ] && [ $counter -ge 4 ]
then
TECHNICAL_ID=$TECHNICAL_ID" "$COLNAME
fi
if [ $COLNAME = "LFD_NR_B2USG" ]
then
echo "LADE_NR INTEGER NOT NULL ,">>$DDL_DIRECTORY/$DDL_FILENAME
FLAG=1
fi

The messages are

testing.sh[113]: test: 0403-004 Specify a parameter with this command.
testing.sh[117]: test: 0403-004 Specify a parameter with this command.
testing.sh[127]: test: 0403-004 Specify a parameter with this command.



Quote:
Originally Posted by anbu23
eq is used for numerical comparison
Code:
if test [ $COLNAME = "BUCH_DAT" ]

# 4  
Old 06-29-2007
Code:
if [ "$FLAG" -eq 0 ] && [ "$COLNAME" != "LFD_NR_B2USG" ] && [ "$counter" -ge 4 ]
then
   TECHNICAL_ID=$TECHNICAL_ID" "$COLNAME
fi
if [ "$COLNAME" = "LFD_NR_B2USG" ]
then
   echo "LADE_NR INTEGER NOT NULL ,">>$DDL_DIRECTORY/$DDL_FILENAME
   FLAG=1
fi

# 5  
Old 06-29-2007
Thanks Aigles

This solves the messages.


Quote:
Originally Posted by aigles
Code:
if [ "$FLAG" -eq 0 ] && [ "$COLNAME" != "LFD_NR_B2USG" ] && [ "$counter" -ge 4 ]
then
   TECHNICAL_ID=$TECHNICAL_ID" "$COLNAME
fi
if [ "$COLNAME" = "LFD_NR_B2USG" ]
then
   echo "LADE_NR INTEGER NOT NULL ,">>$DDL_DIRECTORY/$DDL_FILENAME
   FLAG=1
fi

# 6  
Old 06-29-2007
it is safest to always enclose parameters in quotes,
if they are null the test then will not fail


[ "$this" -eq "$that" ]
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

A test command parameter is not valid, when special characters are tried to match

Hi I have a scenario where hyphen(-) from file should be ignored I used the following code if && ; then if ; then pow=$LINE echo $pow > history.txt flag=1 fi fi I get the following output ./valid.sh: -: 0403-012 A test... (7 Replies)
Discussion started by: Priya Amaresh
7 Replies

2. Shell Programming and Scripting

Help with error "por: 0403-012 A test command parameter is not valid."

Hi, im asking for help with the next script: echo ^; then if then printf "\033 query1.sh: export TERM=vt100 export ORACLE_TERM=at386 export ORACLE_HOME=/home_oracle8i/app/oracle/product/8.1.7 export ORACLE_BASE=/home_oracle8i/app/oracle export... (8 Replies)
Discussion started by: blacksteel1988
8 Replies

3. Shell Programming and Scripting

Command that takes one parameter and then searches for the passed in parameter

Hi I am looking for a unix command or a small shell script which can takes one parameter and then searches for the passed in the parameter in any or all files under say /home/dev/ Can anyone please help me on this? (3 Replies)
Discussion started by: pankaj80
3 Replies

4. Shell Programming and Scripting

if condition error: test: 0403-004 Specify a parameter with this command

Hi all, I would like to ask if there's something wrong with my if - else condition, i couldn't run the script perfectly due to the error in my if - else condition stating that "test: 0403-004 Specify a parameter with this command." below is the snippet of my script if && && ] then echo... (5 Replies)
Discussion started by: jihmantiquilla
5 Replies

5. UNIX for Dummies Questions & Answers

Error message with tail command

Hello, I wrote a script and part of the script, I have a validation to check if the file has <EOF> on the last line of the file. If it does not have a <EOF>, then a message has to be written to a log file. the code snippet shown below works fine, but it writes the below message if the... (1 Reply)
Discussion started by: Vijay81
1 Replies

6. UNIX for Dummies Questions & Answers

error with TEST command

Hi, I have written a script to compare 2 string values.. below is the script.. it throws an error - ./compare_str.sh: test: amount1|amount2: unknown operator.. as both are string values, I am using a = operator in the test command. can some one help me figure out where the issue is?... (11 Replies)
Discussion started by: Vijay81
11 Replies

7. Shell Programming and Scripting

A test command parameter is not valid

Hello, Getting error "A test command parameter is not valid" when trying to run the code below under /sbin/sh AA = "12:00" CHK=$(date +"%H:%M") if then print "Yes" fi Getting 2 errors: 1) "AA: not found" 2) "Specify a parameter with this command" Thanks, IS Please... (5 Replies)
Discussion started by: schureki
5 Replies

8. Shell Programming and Scripting

awk command - not a valid identifier message

Trying to run the following awk command : export com.mics.ara.server.tools.sch_reports.Runner.num_threads=`awk -F= '!/^#/ && /com.mics.ara.server.tools.sch_reports.Runner.num_threads/{print $2}' $BKUPDIR/env.properties` -bash: export:... (6 Replies)
Discussion started by: venhart
6 Replies

9. AIX

Audit problem : A system call received a parameter that is not valid.

while i try to start the audit i have the below error message . audit>audit start ** auditing enabled already A system call received a parameter that is not valid. please advice (6 Replies)
Discussion started by: thecobra151
6 Replies

10. Shell Programming and Scripting

Strange error message with regex test...

Hi all, I have a script where i need to check the format of a string. finally, i'm waiting a "process name" and 2 numbers separated by a "," string like : "this_is_a_string.txt,1,10 should be ok" string ok : "apache.exe,1,10" string ok : "mysqld,50,0" string not ok : "ap ache,1,10"... (4 Replies)
Discussion started by: fgilain
4 Replies
Login or Register to Ask a Question