Testing a comand in the script


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Testing a comand in the script
# 1  
Old 01-25-2007
Testing a comand in the script

Hi everyone , i am new to shell scripting and am having some problem to test if this line has been executed well and display a pass message on the screen or fail if not
sqlplus XXTEST/$2 <<END > $XXTEST_TOP/log/$0.log
@$XXTEST_TOP/admin/sql/XXTEST_SPE1_XX_QUOTE_DETAILS_TBL.sql XXTEST$2 XXTEST_DATA XXTEST_IDX APPS $1
END


Can anyone help me please its really important.... Thank you in advance
Lutchumaya
# 2  
Old 01-25-2007
Possible sol 1
if you set the $? to a variable after at the END then it may provide you with the result 0=pass or >0 fail. However I think the result may be from the sql block not the sql script.

Possible sol2
The other option is to do the Pass or Fail test in your sql script and echo a PASS or FAIL. This way you could run your sql block thus.

end_sql=`sql <<END line1;line2;END`

echo $end_sql

I don't play with sql at all any more but you could try either one of these and see what works. Just be careful that if you use $? in possible solution 1 you may get the result of the END statement.


You will need to test and be sure.

If this don't work then may be it may spark an idea in some one else in the forum..
# 3  
Old 01-25-2007
Thanks for your help Andrek but i didnt understand can u be more explicit thanks for your attention.... I am really new to shell programming here just been looking at it for a week here...
Thank you again
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. AIX

Testing Kerberos with kinit comand

I am working on an AIX 6.1 system with Kerberos 1.5.0.8. I am attempting to execute the kinit command but after I execute the command and put in a password I get the following error message: Unable to obtain initial credentials Status 0x96c73a18 - Preauthentication failed. I have found... (0 Replies)
Discussion started by: kstalder
0 Replies

2. Shell Programming and Scripting

Need comand or script for append text after searching for the desired string

Hi all, i have a generated report in unix in the following command like input.txt 47.85,10 0124,42.35,8 0125,3.5,2 the input file format is fixed I need the my output file with append text as below output.txt 0124 amount:42.35 0125 amount:3.5 0124 count : 8 0125... (34 Replies)
Discussion started by: hemanthsaikumar
34 Replies

3. Homework & Coursework Questions

script to mail users on comand line

Use and complete the template provided. The entire template must be completed. If you don't, your post may be deleted! 1. The problem statement, all variables and given/known data: Write a shell script to send a customized mail message to the users listed on the command line by login (user)... (3 Replies)
Discussion started by: alis
3 Replies

4. Shell Programming and Scripting

Preserve extented ascii character when run echo comand inside bash script

Hi everyone, I'm echo some text with extended ascii characters as below: echo -e "Pr\xE9sentation du spectacle" > output or echo -e "Présentation du spectacle" > outputIf I open the file created I see this text Présentation du spectacleThe text is shown correctly in this created file when... (7 Replies)
Discussion started by: Ophiuchus
7 Replies

5. Shell Programming and Scripting

Script Testing

Hello Scripting Czars I have written one script, which does the Openssl Connection test to 1000's of server's , but before it finally takes off , its error-ring out, kindly take a look into this. #!/bin/bash #Script to Test Connectivity withListen Address & Port Address #Script... (10 Replies)
Discussion started by: raghunsi
10 Replies

6. Solaris

Using dd comand

Hello peolple i have to check a tape with de dd comand and redirect the exit dd if=/dev/rmt/0cn ibs=1024k of=/dev/null i need that the exit from that commando go to a log if a do this dd if=/dev/rmt/0cn ibs=1024k of=/dev/null > x.log don`t send me nothing to the log only in the screen. I need... (1 Reply)
Discussion started by: enkei17
1 Replies

7. Shell Programming and Scripting

Testing connection with a script

I have a box that has to start dhcpd when a certain connection is down and stop the dhcpd when the connection is up again. I would appriciate any help making this script: From server A: ping server B if connection is ok then do nothing if connection is not ok then start dhcpd until... (8 Replies)
Discussion started by: KimJensen
8 Replies

8. Solaris

comand df -k

I need to know the available space in my unix. when making a df -k it shows me the following thing: /dev/vx/dsk/emc2/vol06 136764867 121542767 1545614 99% /emc06 would need them to explain to me well the command. since under the column avail the resulting value is... (2 Replies)
Discussion started by: roviedo
2 Replies

9. Shell Programming and Scripting

Testing telnet connections in a script

Hi, I am trying to figure out how to test to see if a server is accepting telnet connections via a script. I have several remote MPE servers that are set in single user mode (and hence not accepting telnet connections), for their backups, I want to try and automate a test (from a unix... (0 Replies)
Discussion started by: dikiee
0 Replies

10. UNIX for Dummies Questions & Answers

testing for file size in script

Has anyone got a few tips on how I can test if the file size is 0? I am moving files on a regular basis from one location to another with ftp. The files which are 0 bytes in size we want to discard. Thankyou in advance. (3 Replies)
Discussion started by: Ivo
3 Replies
Login or Register to Ask a Question