Not able to capture error while using dialog


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Not able to capture error while using dialog
# 1  
Old 07-10-2012
Not able to capture error while using dialog

I am not able to capture errors while I am using dialog. For example:
Code:
dialog --gauge "Verifying file..." 10 75 < <(

while read LINE
do 
	hash=$(echo $LINE | cut -f1 -d' ')
	directory=$(echo $LINE | cut -c 34-)
 	PCT=$(( 100*(++i)/n ))

	echo $PCT

	md5deep -a $hash $directory > /dev/null
	RESULT=$?
	if [ $RESULT -ne 0 ]
	then
		dialog_hash_failed	
		error "Failed"
	fi

       

done < $TAR_SO/$SOURCEFILE_NAME.md5 
)||exit 1

However, if I get rid of the dialog command, I am able to capture all errors in the md5 verification. While using dialog, the code exits successfully but the return value is always a zero. I am expecting a non zero return value and I am able to achieve it while not using dialog
# 2  
Old 07-10-2012
Using dialog, the return value is the the one of dialog itself ( success! as you say... so 0...) not from the while...

Last edited by vbe; 07-10-2012 at 11:49 AM.. Reason: typo
# 3  
Old 07-10-2012
So there is no way I could trap the error from the while loop?
# 4  
Old 07-10-2012
Maybe using co process (using shell that supports e.g. ksh...) but I have no knowldge of dialog... Is there nothing in the man pages? ( sorry no linux around today... only aix, solaris, hp-ux...)

Last edited by vbe; 07-10-2012 at 12:03 PM..
Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Capture error before pipe

Hi, I have a script that runs a tar command to standard out then pipes to a gzip: tar cfE - * | gzip -c > OUT.gz At the moment, even if the tar fails (e.g. because of lack of disk space), the gzip still runs successfully. Is there a way to make the whole line exit with a non-zero error... (6 Replies)
Discussion started by: Catullus
6 Replies

2. Shell Programming and Scripting

Dialog , capture multiples inputs in variables

Hi everyone , i am trying to do a shell script with dialog , but i have a problem capturing each input variable to then use "echo" to write those inputs on specific orders in a file . If i use this code : dialog --backtitle "Dialog Form Example" --title "Dialog - Form" \ --form "\nDialog... (1 Reply)
Discussion started by: pedropt
1 Replies

3. Shell Programming and Scripting

How to capture the error code a use it in error table?

Hello Everyone, I have written a file validation script in unix to compare the data and trigger file.My requirement is if the file validation fails,I need to upate the error details in a table ex:Below is the one of many validation checks i am doing if then echo "Actual count between... (3 Replies)
Discussion started by: karthik adiga
3 Replies

4. UNIX for Dummies Questions & Answers

How to Capture Informatica Error logs?

HI Team , Is there a way to capture information logs ( session or workflow ) and grep only ERROR or FAIL messages and send to email distro using mailx or sendmail option. I have around 200 sessions running on daily basis and this script has to run every day , and capture only error... (0 Replies)
Discussion started by: Perlbaby
0 Replies

5. UNIX for Dummies Questions & Answers

Capture crash out error report...

Google is not helpful here. It is probably trivial but I can't get my head around it. How do I capture an error which crashes out due to say a syntax error to a file? (Note that I manually reset error.log to zero length.) Consider this junk code:- #!/bin/sh # Launch as ./trap.sh... (2 Replies)
Discussion started by: wisecracker
2 Replies

6. UNIX for Dummies Questions & Answers

Capture Error In SQL Plus

Hi I am trying to fetch the data from Oracle Table More my_query.sql | sqlplus -s 'scott/tiger@OrcaleSID ' | sed 's///g;s///g' > sample_file Now if the table passed in the my_query.sql is wrong or there is some other error insied SQL how i can caputure that i tried More... (1 Reply)
Discussion started by: max_hammer
1 Replies

7. Shell Programming and Scripting

database instance Error capture

I wrote a script to capture some rows from the DB. However I want to capture the errors if the DB instance is down which usually produces errors like below. What should be my approach to kill script if the DB instance is down: DATABASE ERRORS: Msg 937, Level 14, State 1: Server... (2 Replies)
Discussion started by: moe458
2 Replies

8. Shell Programming and Scripting

Unix / Linux Dialog Utility - how to open 2+ more dialog windows ?

Hi, example of Unix / Linux dialog utility is below. I am going to use dialog as simple GUI for testing of a modem. So I need to combine some dialog boxes into one. I need to have input box, output box, info box, dialog box, radiobox as in any standard program with graphical user... (2 Replies)
Discussion started by: jack2
2 Replies

9. Shell Programming and Scripting

sqlplus -s error capture

Hi folks a wee problem that requires some help. I am writing a script that allows me to automate the changing of a password in sqlplus the problem i encounter is that the code contains a case statement that allows the helpdesk to select whether to allow or deny access by switching the... (1 Reply)
Discussion started by: w33man
1 Replies
Login or Register to Ask a Question