Sponsored Content
Top Forums Shell Programming and Scripting Help with error "por: 0403-012 A test command parameter is not valid." Post 302795385 by blacksteel1988 on Wednesday 17th of April 2013 03:47:31 PM
Old 04-17-2013
Wrench

Quote:
Originally Posted by Yoda
I noticed that you are selecting string: 'MAILS PENDING : ' and concatenating with count(*), this will result in having an alphanumeric value in variable: VAR1:
Code:
SELECT   'MAILS PENDING  :  ' || COUNT ( * )   "Correo Por Enviar" FROM
SCHEMA.CSIC_MAILS_fOR_SEND@VIRT.DB.TGU.COM  WHERE   estado = 0;

So if you try to do a numeric comparison: if [ $VAR1 -ge 200 ] it will fail because you have alphanumeric value in this variable.

I suggest you to modify your query to get just the record count:
Code:
SELECT COUNT(*) FROM
SCHEMA.CSIC_MAILS_fOR_SEND@VIRT.DB.TGU.COM  WHERE estado = 0;

Well it worked, thank you so much Yoda. now... i have another question... my code is now like this:

Code:
echo ^[[32m  MAILS PENDING HN ^[[37m
VAR1=`query1.sh`
DISP1="Amount of mails pending  :"$VAR1
if [ $VAR1 -ge 200 ];
  then
     if [ $VAR1 -ge 300 ]
      then
         printf "\033[01;31m%s\033[00m\n" "$VAR1"
      else
         printf "\033[01;33m%s\033[00m\n" "$VAR1"
      fi
   else
         printf "\033[01;32m%s\033[00m" "$DISP1" #<---- i created this variable for testing but the result is the same
fi

  sleep 30
  clear
done;

and the display goes like this:

"Amount of mails pending :
41 "

Yes... they are displayed in diferent lines and i would like to make them appera in the same line.... help plz.

I already removed \n and it didnt worked....
 

10 More Discussions You Might Find Interesting

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

2. Shell Programming and Scripting

grep "\012$" problem

Hi, I am trying to weed out DOS '^M' new-line characters from a file which I copied from windows inside my Linux box, using this following script. But it seems this script is not working properly if I have made a check 'xargs grep -l "\012$"'. Here, I am trying to filter only the files which... (4 Replies)
Discussion started by: royalibrahim
4 Replies

3. Shell Programming and Scripting

awk command to replace ";" with "|" and ""|" at diferent places in line of file

Hi, I have line in input file as below: 3G_CENTRAL;INDONESIA_(M)_TELKOMSEL;SPECIAL_WORLD_GRP_7_FA_2_TELKOMSEL My expected output for line in the file must be : "1-Radon1-cMOC_deg"|"LDIndex"|"3G_CENTRAL|INDONESIA_(M)_TELKOMSEL"|LAST|"SPECIAL_WORLD_GRP_7_FA_2_TELKOMSEL" Can someone... (7 Replies)
Discussion started by: shis100
7 Replies

4. UNIX for Dummies Questions & Answers

Unix "look" Command "File too large" Error Message

I am trying to find lines in a text file larger than 3 Gb that start with a given string. My command looks like this: $ look "string" "/home/patrick/filename.txt" However, this gives me the following message: "look: /home/patrick/filename.txt: File too large" So, I have two... (14 Replies)
Discussion started by: shishong
14 Replies

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

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. Shell Programming and Scripting

Error passing parameter in "sub" command in awk

I have to replace the pattern found in one file in another file with null/empty "" if found on the fields 3 or 4 ONLY File 1 ==== 10604747|Mxdef|9999|9999|9999|2012-03-04 00:00:59 10604747|Mcdef|8888|9999|8888|2012-03-04 00:00:59 . . . File 2 ==== 9999 8888 . . . Expected... (7 Replies)
Discussion started by: machomaddy
7 Replies

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

9. UNIX for Dummies Questions & Answers

What is the significance of sh -s in ssh -qtt ${user}@${host} "sh -s "${version}"" < test.sh?

Please can you help me understand the significance of providing arguments under sh -s in > ssh -qtt ${user}@${host} "sh -s "${version}"" < test.sh (4 Replies)
Discussion started by: Sree10
4 Replies

10. UNIX for Dummies Questions & Answers

Using "mailx" command to read "to" and "cc" email addreses from input file

How to use "mailx" command to do e-mail reading the input file containing email address, where column 1 has name and column 2 containing “To” e-mail address and column 3 contains “cc” e-mail address to include with same email. Sample input file, email.txt Below is an sample code where... (2 Replies)
Discussion started by: asjaiswal
2 Replies
script(1)						      General Commands Manual							 script(1)

NAME
script - Makes a transcript of terminal session SYNOPSIS
script [-a] [file] The script command makes a transcript of everything printed on your terminal. OPTIONS
Appends the transcript to file rather than writing it to file. OPERANDS
The name of an output file that will contain the transcript of the session. If this parameter is omitted, the file typescript is written. DESCRIPTION
The transcript is written to file, or appended to file if the -a option is given. If no file name is given, the transcript is saved in the file typescript. The script ends when the forked shell exits. This program is useful when you are using a CRT and want a hard-copy record of the dialog (for example, a technical writer might create an example of a working session this way). If you specify the -a option and the file does not exist, it is created. If you do not specify the -a option and the file exists, it is replaced. RESTRICTIONS
The script command requires a streams based terminal. In single user mode, streams may not be enabled. Under these circumstances, script will exit with no action. If you are the superuser and need to run this command in single user mode, use the following special instruc- tions. Enabling Streams If it is necessary to enable a streams environment in the single user mode, enter the command /sbin/init.d/streams. This command is avail- able to the superuser only. SEE ALSO
Commands: autopush(8), cat(1), echo(1), strsetup(8), tee(1) System Administration script(1)
All times are GMT -4. The time now is 03:58 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy