A test command parameter is not valid


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting A test command parameter is not valid
# 1  
Old 10-19-2011
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
Code:
AA = "12:00"
CHK=$(date +"%H:%M")
if [ $CHK == $AA ]
then
     print "Yes"
fi

Getting 2 errors:
1) "AA: not found"
2) "Specify a parameter with this command" [in line 3 ]

Thanks,
IS

Moderator's Comments:
Mod Comment Please use code tags

Last edited by zaxxon; 10-19-2011 at 09:37 AM.. Reason: code tags, see PM
# 2  
Old 10-19-2011
Remove the blanks between the variable name, the equal sign and the value.
Code:
AA="12:00"
...

# 3  
Old 10-19-2011
Remove the spaces between AA and =

AA="12:00"

I believe that will correct both of your errors.
# 4  
Old 10-19-2011
Getting "A test command parameter is not valid." for line "if [ $CHK == $AA ]"
# 5  
Old 10-19-2011
Then have a look what the test parameters are with adding a set -x in the beginning of this script.

When you post the output, use code tags as already stated above.
# 6  
Old 10-19-2011
Here what I get:-
Code:
# ./test.sh
+ AA=12:00
+ + date +%H:%M
CHK=14:54
+ print 14:54
14:54
+ [ 14:54 == 12:00 ]
./test.sh[5]: ==: A test command parameter is not valid.

---------- Post updated at 04:51 PM ---------- Previous update was at 02:56 PM ----------

Have to use one = and not ==

Last edited by Franklin52; 10-19-2011 at 10:43 AM.. Reason: Please use code tags, thank you
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

[BASH] (own) command is not a valid identifier

Heya fellows Yes, script-tools and TUI are both my 'children', so i cant go anywhere (else) and ask for help/bugfixes as i need to write them myself. However i do need help to understand error messages at times (or get hints what else might cause them), so here we go: Since my new computer... (4 Replies)
Discussion started by: sea
4 Replies

2. 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

3. 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

4. Shell Programming and Scripting

403-009 The specified number is not valid for this command.

Error Message: dm2_oraver: 9xdm2_oraver2: LT11/w_standard/gold_wh/install/dm2_updatetns.ksh: 11MAR13: 0403-009 The spe cified number is not valid for this command. if means the line number in the ksh, it is ((CntNew=Cnt+1)). Please let me know the best way to debug and find it out. I am... (4 Replies)
Discussion started by: Daniel Gate
4 Replies

5. 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

6. 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

7. 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

8. Shell Programming and Scripting

Whether a string is a valid unix command

How to find a string which is entered in command promt is a valid unix command or not?. Thanks in advance ~Saravana (2 Replies)
Discussion started by: tsaravanan
2 Replies

9. Shell Programming and Scripting

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 then // SomeCode fi The messages are as follows: testing.sh: OBLIGOR_GROUP_ID: 0403-012 A test command parameter is not valid. testing.sh:... (5 Replies)
Discussion started by: skyineyes
5 Replies

10. UNIX for Dummies Questions & Answers

pwd: A specified flag is not valid for this command.

Probably a very straight forward question but please be easy on me, I am v. new to UNIX! A script that I have runs the line tmp=`pwd -H` It works fine, but I needed to make a couple of other changes to the script, nowhere near this line but now this line reports: pwd: A specified flag... (2 Replies)
Discussion started by: Paxton
2 Replies
Login or Register to Ask a Question