How to handle errors during script execution


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting How to handle errors during script execution
# 1  
Old 09-15-2009
How to handle errors during script execution

Hi
I have written a script which returns a number. This resulting number I assign to the variable for example:

$ A=`get_dbnum 118 ttrn`
$ echo ${A}
8208
$


The script becomes interective once the error occures and the number is not found. It prompts the user to enter the number. The problem is that the prompts are not showing during the execution (I am not sure why) , the script hangs and all user prompts are getting assigned to the variable after abort, for example:

p338$ A=`get_dbnum 34 ttrn`
p338$ echo $A
POSSIBLE DUPLICATE ENTRIES IN /TSTMP/DBNUMBERS.NXT POSSIBLE SLOTS ARE: #29 #98 PLEASE CHECK THE FILE AND ENTER THE SLOT NUMBER OR Cntl-C TO EXIT>

Is there a way to make the prompts visible to the user? Any advice on how to handle similar issues....
Thanks a lot
# 2  
Old 09-15-2009
Please show us the place in the code where you prompt the user and read input.
Can we assume the script runs interactively?
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Abort the execution if one script have errors

Gents, I have a script which will run others scripts . Example #!/bin/bash script1 script2 script3 script4 I would like to stop all process if any of the script got errors?. If for example script1 works fine will continue script2, then if the script2 got errors, The bash should... (2 Replies)
Discussion started by: jiam912
2 Replies

2. Shell Programming and Scripting

Need exception handle for this script

Hi This is script to move log files from one location to other which is working fine. I need to add exception handling in this new to scripting. Please help #!/bin/ksh DB=QACCABOP dumppath='/udb/udbpa032/dump_data/offshore/Tran_logs' msg='/udb/udbpa032/utilities/DBAscripts/msg/msg.out'... (4 Replies)
Discussion started by: Mathew_paul
4 Replies

3. Shell Programming and Scripting

Handle occasional condition in expect script

Hi, I am using Solaris OS, I want to handle an occasional expression in expect script while logging into a remote server with ssh. In normal scenario the expected expression is as below, spawn ssh $user@$ip expect "assword:" send "$password\r" but in a condition when the remote server... (2 Replies)
Discussion started by: varunksharma87
2 Replies

4. Shell Programming and Scripting

Need help to handle errors during SFTP

Hi, I have written a script that sftp's files from linux box to a IBM machine. Can anybody help me how to handle any errors during SFTP file transfer. I am writing the SFTP commands onto a file and executing that as you can see below. while read line do if ] && ]; then echo "put... (1 Reply)
Discussion started by: ramkiran77
1 Replies

5. Shell Programming and Scripting

Help with execution errors in script

solution found.... Please use tags for scripts, listings, and console output (2 Replies)
Discussion started by: audiolord
2 Replies

6. Shell Programming and Scripting

How to handle errors and warnings

Hi Guys, I am working on a shell script(main script) where in i have to call another script B and pass parameter to that script. I see that the shell script that is being called in the main script is throwing warnings/fatal errors. So i am just wondering how do i capture these and ask the script... (1 Reply)
Discussion started by: stunnerz_84
1 Replies

7. Shell Programming and Scripting

help to handle the expect script issue

Hi experts I know the expect script can match the terminal output to run the the following cmd I write a script with expect named "test", I want to run ten "test" with background running, for ((i=1;i<=10;i++) do ./test -n $i done I find all the output of test will print on one... (0 Replies)
Discussion started by: yanglei_fage
0 Replies

8. Shell Programming and Scripting

i'm new to shell can handle this script for me plz

Write a shell script named displayargs that prints FOUR lines. The first line tells the name that was used to invoke the script, the second line tells how many parameters there were, the third line tells what the last parameter was, and the fourth line tells what the first parameter was. For... (8 Replies)
Discussion started by: kedah160
8 Replies

9. Shell Programming and Scripting

Database handle to a child script using exec

Hello, Can I pass a database handle created in parent script to a child script triggered using exec ?? Parent script ========= $dbh =DBI->connect{......); # Db handle creation $param1 =10; # parameter one exec "childscript.pl $param1 $dbh "; # executing childscript.pl with two parameters... (0 Replies)
Discussion started by: coolbhai
0 Replies

10. Shell Programming and Scripting

how to handle sql loader errors in unix

hi all, how to handle sql loader errors in unix shell ?? thanks in advance gemini (3 Replies)
Discussion started by: gemini106
3 Replies
Login or Register to Ask a Question