Error handling in Unix shell scripting


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Error handling in Unix shell scripting
# 1  
Old 09-04-2009
Error handling in Unix shell scripting

Hello,

I have written a shell script and suppose there is any error in the script. How i can do exception handling in shell script.for example i have below code

sqlplus -s <<uid>>/<<pwd>>@<<$ORACLE_SID>> <<EOF > 1_pid1.log
set pagesize 0
set feedback off
set heading off
set linesize 200
@ pid_file.sql
exit
EOD

when i run above code it should create log file with 1_pid1.log
but it was not working becuase at the last line i did spelling mistake and writtern "EOD" instead off "EOF".

So i just want to know, how can i do error handling in unix shell script.

Thanks in Advance,
# 2  
Old 09-04-2009
its a 'script', parsed line by line.
you wont find error until line is parsed or EOF is reached searching for expected line
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Programming

unix Shell scripting

Hi All, need help to complete the automation but stuck at a perticular situation below is the code <code> fixed_function_name { code.... code.... variable_map= { a="/a" b="/b" c="/c" so on... } (7 Replies)
Discussion started by: yadavricky
7 Replies

2. UNIX for Dummies Questions & Answers

Unix Shell Scripting( Calling from Unix to PLSQL)

Hello Experts, I have the following questions to be discussed here at this esteemed discussion forum. I have two Excel sheets which contain Unix Commands llike creating directory the structure/ftp/Copy/Zip etc to basically create an environment. I need help in understanding some of... (1 Reply)
Discussion started by: faizsaadq
1 Replies

3. UNIX for Dummies Questions & Answers

File handling in bash shell scripting

i am new to shell scripting and stuck at one place in my program. i am reading data from one structured file and extracting some data from particular lines and then writing into the output file. In that reading input file line by line from while loop. while read line do rectype=line... (7 Replies)
Discussion started by: reeta_shri
7 Replies

4. Shell Programming and Scripting

$# in unix shell scripting what does it mean

Hi can some one let me know what is the meaning of $# $@ $_ @_ in unix shell scripting. I really appreciate your time for replying to my post. Thanks In Advance (4 Replies)
Discussion started by: einsteinBrain
4 Replies

5. Shell Programming and Scripting

Advanced error handling in shell scripts

Hi all I've got a question regarding error handling in shell scripts. My background is mainly object oriented programming languages, but for a year or so I've been doing more and more (bash) shell scripting (which I quite enjoy by the way). To handle errors in my scripts I... (3 Replies)
Discussion started by: script_man
3 Replies

6. Shell Programming and Scripting

File handling with bash shell scripting

Hi all, Can anyone guide to get tricks for file handling in bash shell? Thanks in advance. Thanks Deepak (2 Replies)
Discussion started by: naw_deepak
2 Replies

7. Shell Programming and Scripting

file handling with ksh scripting

how can i write content of a variable to a file? how can i read standard output into a variable? (1 Reply)
Discussion started by: gfhgfnhhn
1 Replies

8. Shell Programming and Scripting

difference between AIX shell scripting and Unix shell scripting.

please give the difference between AIX shell scripting and Unix shell scripting. (2 Replies)
Discussion started by: haroonec
2 Replies

9. UNIX for Advanced & Expert Users

Error Handling in Korn Shell scripts

Hi, I am using few ISQL statements to update and delete from a few tables in sybase, now i want to roll back the transaction when any of the statements fail.How i can i capture these errors in the shell scripts.Please advise. Thanks, Gopi (4 Replies)
Discussion started by: bhgopi
4 Replies

10. UNIX for Dummies Questions & Answers

Unix shell scripting

I need to write a script which analyses an invoice file, counting the amount of pages in the file to be printed per account number and per invoice. The account numbers are stored in another file which has instructions on what do with ach customers invoice as per their account number. please... (6 Replies)
Discussion started by: la_burton
6 Replies
Login or Register to Ask a Question