Sponsored Content
Top Forums Shell Programming and Scripting avoid displaying errors while executing a script Post 302142765 by aigles on Monday 29th of October 2007 01:15:50 PM
Old 10-29-2007
Fist solution (the worst) : Ignore errors and redirec error output to null device
At the begining of the script :
Code:
exec 2>/dev/null

Second solution (simply the best) : Correct errors in script.
A way to determine the origine of the error is to execute the script with the debug option -x

Jean-Pierre
 

10 More Discussions You Might Find Interesting

1. Programming

Errors while executing a.out

Hi, I tried a simple hello.cc program in Unix. - Compiled with no errors - Created a.out successfully - While executing a.out, following error message appeared " ld.so.1:a.out fatal: libstdc++.so.2.10.0: Open failed: No such file or directory Killed" ... (1 Reply)
Discussion started by: nirthana
1 Replies

2. Programming

What is the proper way to combine C++ files (with g++) to avoid link (ld) errors?

Problem background: gcc v 4.1 2 .cpp files, 2 .h files Files: main.cpp a.cpp a.h b.h Organization: main.cpp includes a.h (because it calls a.cpp code) a.cpp includes a.h a.h includes b.h (because a class in a.h uses a b.h class) There is no inheritance between a.h or b.h or any of... (1 Reply)
Discussion started by: johnqsmith
1 Replies

3. Shell Programming and Scripting

Errors while executing cmds in sun solaris

Hi All, I am using mysql at sun solaris unix(Hp) server. I logged into mysql server with root as user. its logged in properly. Then i used 'show databases' mysql command. its display all the available databases. for example mysql > show databases; It displayed as follows. exampledb1 ... (1 Reply)
Discussion started by: dbsurf
1 Replies

4. UNIX for Dummies Questions & Answers

Errors while executing mysql cmds in SUn solaris server

Hi All, I am using mysql at sun solaris unix(Hp) server. I logged into mysql server with root as user. its logged in properly. Then i used 'show databases' mysql command. its display all the available databases. for example mysql > show databases; It displayed as follows. exampledb1... (1 Reply)
Discussion started by: dbsurf
1 Replies

5. Solaris

Any way to avoid these errors?

Hello, this is solaris 10 on SF v440, I know below errors might go away if I put a new PS or put the original one back in socket but is there any other way to stop these errors from appearing in /var/adm/messages ? I do not want to put the failed PS1 in socket neither do we want to spend on... (5 Replies)
Discussion started by: upengan78
5 Replies

6. Shell Programming and Scripting

perl script to send an email executing with errors

Hello , i am using RHEL5 , i have got a perl script that executes and sends an email correctly if i run it with ./sendemail.sh command. This is the script below #! /usr/bin/perl use Net::SMTP; print "starting email send ."; $smtp = Net::SMTP->new("192.168.0.1");... (2 Replies)
Discussion started by: kabazzi
2 Replies

7. Shell Programming and Scripting

Avoid interaction into script

Sorry for my english! I'm using Debian squeeze and for an assignement, i have create 2 virtual pdf cups printers. Both are working very well. To test the different administion command; i try to disable one of the printer and move his queue file to the second one. I'm able to do it easily. ... (4 Replies)
Discussion started by: lyapma
4 Replies

8. Shell Programming and Scripting

Bash script errors when executing

I'm working on a script that will search through a directory for MKV files and remux them to MP4. I found a few other scripts around the net that do this, but they all have limitations that don't always get the job done. The main limitation I've found is that most scripts look for the video track... (2 Replies)
Discussion started by: rayne127
2 Replies

9. Shell Programming and Scripting

shell_script showing errors in the below mentioned script while executing in linux

code: IMAGE=$imgvalue; if then echo DO=ABC; elif then echo DO=ETC; elif then echo DO=XYZ; else echo "$imgvalue is unsupported"; exit 1; fi in above script IMAGE=1 , IMAGE=2, IMAGE=3 whatever may be the value i have assigned it's showing only DO=ABC other conditions... (7 Replies)
Discussion started by: saku
7 Replies

10. AIX

How to avoid errors when moving files in a bff?

I am building a bff using mkinstallp. My template file is : Package Name: svr_exForum Package VRMF: 7.2 Update: N Fileset Fileset Name: svr_exForum.rte Fileset VRMF: 7.2 USRLIBLPPFiles Pre-installation Script: /lppdir/lpp/exForum/F_pre_i ... (2 Replies)
Discussion started by: kevinl
2 Replies
catch(n)						       Tcl Built-In Commands							  catch(n)

__________________________________________________________________________________________________________________________________________________

NAME
catch - Evaluate script and trap exceptional returns SYNOPSIS
catch script ?varName? _________________________________________________________________ DESCRIPTION
The catch command may be used to prevent errors from aborting command interpretation. Catch calls the Tcl interpreter recursively to exe- cute script, and always returns without raising an error, regardless of any errors that might occur while executing script. If script raises an error, catch will return a non-zero integer value corresponding to one of the exceptional return codes (see tcl.h for the definitions of code values). If the varName argument is given, then the variable it names is set to the error message from interpret- ing script. If script does not raise an error, catch will return 0 (TCL_OK) and set the variable to the value returned from script. Note that catch catches all exceptions, including those generated by break and continue as well as errors. The only errors that are not caught are syntax errors found when the script is compiled. This is because the catch command only catches errors during runtime. When the catch statement is compiled, the script is compiled as well and any syntax errors will generate a Tcl error. EXAMPLES
The catch command may be used in an if to branch based on the success of a script. if { [catch {open $someFile w} fid] } { puts stderr "Could not open $someFile for writing $fid" exit 1 } The catch command will not catch compiled syntax errors. The first time proc foo is called, the body will be compiled and a Tcl error will be generated. proc foo {} { catch {expr {1 +- }} } KEYWORDS
catch, error Tcl 8.0 catch(n)
All times are GMT -4. The time now is 07:11 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy