Sponsored Content
Full Discussion: if condition issue
Top Forums Shell Programming and Scripting if condition issue Post 302610667 by svajhala on Wednesday 21st of March 2012 02:41:07 PM
Old 03-21-2012
Good catch. I missed it somehow.

Thanks,
Sri
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

An issue with condition statement in shell script

Hello forum members. please go through the below mentioned issue and let me know the right solution. I have to write a script which runs another script .the executable script take input parmeters.so iam writing the the script below . Sample Code:Begins #! /bin/ksh echo " enter... (2 Replies)
Discussion started by: rajkumar_g
2 Replies

2. UNIX for Dummies Questions & Answers

If condition issue

Hello, I am using the following code #!/bin/sh chris='rerun' chris2=$1 echo "chris=$chris" echo "chris2=$chris2" if then echo "RERUN" else echo "NOT RERUN" fi (6 Replies)
Discussion started by: chriss_58
6 Replies

3. Shell Programming and Scripting

if condition issue

Hi, Unix Gurus, I got some issue with my script. #!/usr/bin/ksh while read newstatus do if ; then echo "It is finished " else echo "Not Finished" fi done <checkresult.txt basically, I want to read one file (the file only contains one word, but it dynamically changed),... (2 Replies)
Discussion started by: ken002
2 Replies

4. Shell Programming and Scripting

redirect stdout echo command in condition A run in condition B

hi, I have some problems in my simple script about the redirect echo stdout command inside a condition. Why is the echo command inside the elif still execute in the else command Here are my simple script After check on the two diff output the echo stdout redirect is present in two diff... (3 Replies)
Discussion started by: jao_madn
3 Replies

5. Shell Programming and Scripting

Unix and db2 where condition issue(new line)

Hi I am extracting a column value(DESCRIPTION) from one table and passing it to another db2 statement in a shell code to fetch some value(ID) but the value when passed in where condition is taking as newline+value. Please find the out put when executed: + echo description is ::::... (1 Reply)
Discussion started by: msp2244
1 Replies

6. Shell Programming and Scripting

Condition checking issue while if

hi, i am using a simple condition end_ct=`sqlplus -s $ORACLE_USER/$ORACLE_PASS@$ORACLE_SID << EOF select description from bravo_statistics where trunc(time_stamp)=trunc(sysdate)-1 and description='END CAT'; EOF` echo $end_ct; echo... (30 Replies)
Discussion started by: lovelysethii
30 Replies

7. Shell Programming and Scripting

If Condition Issue in UNIX

Hi I am trying to do a "IF" Condition in UNIX where we compare EACH file size in a directory with a SIZE (Parameter passed) If Each File size EXCEEDS parameter passed SIZE then we manipulate the file. Somehow the IF condition do not work ?? (is this Variable decalration issue ??) ... (9 Replies)
Discussion started by: Pete.kriya
9 Replies

8. Shell Programming and Scripting

Issue with IF condition

Getting syntax error when the condition after -o returns more than one file if then echo "Found" fi output: =>ls -l total 5 -rw-rw-r-- 1 wes wes 0 Jun 25 04:51 a.done -rw-rw-r-- 1 wes wes 0 Jun 25 04:51 a.zip -rw-rw-r-- 1 wes wes ... (13 Replies)
Discussion started by: anijan
13 Replies

9. Shell Programming and Scripting

Solaris 11 ksh93 if condition issue

Solaris 11 ksh93 if condition issue Has anyone run into issues with Solaris 11 with ksh93 if condition where it intermittently return wrong return code? We did not see this issue in Solaris 10 with ksh88 Any thoughts? Thanks! Solaris version: SunOS t52-ccc-28 5.11 11.2... (4 Replies)
Discussion started by: nugent
4 Replies

10. Shell Programming and Scripting

Issue with condition "if then elif else fi"

Hi everybody, I must get trought a shell script 3 arguments. 1st argument = $1 (can take values REP1..4) 2nd argument = $2 (can take values A..Z) 3rd arguement = $3 (also can take values A...Z) I've written this code : #!/bin/bash if then liste=/data/folder1 echo... (6 Replies)
Discussion started by: shellX
6 Replies
catch(n)						       Tcl Built-In Commands							  catch(n)

__________________________________________________________________________________________________________________________________________________

NAME
       catch - Evaluate script and trap exceptional returns

SYNOPSIS
       catch script ?resultVarName? ?optionsVarName?
_________________________________________________________________

DESCRIPTION
       The  catch  command may be used to prevent errors from aborting command interpretation.	The catch command calls the Tcl interpreter recur-
       sively to execute 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 the exceptional return code returned  by	evaluation
       of  script.  Tcl defines the normal return code from script evaluation to be zero (0), or TCL_OK.  Tcl also defines four exceptional return
       codes: 1 (TCL_ERROR), 2 (TCL_RETURN), 3 (TCL_BREAK), and 4 (TCL_CONTINUE).  Errors during evaluation of a script are indicated by a  return
       code of TCL_ERROR.  The other exceptional return codes are returned by the return, break, and continue commands and in other special situa-
       tions as documented.  Tcl packages can define new commands that return other integer values as return codes as well, and scripts that  make
       use of the return -code command can also have return codes other than the five defined by Tcl.

       If  the	resultVarName  argument  is given, then the variable it names is set to the result of the script evaluation.  When the return code
       from the script is 1 (TCL_ERROR), the value stored in resultVarName is an error message.  When  the  return  code  from	the  script  is  0
       (TCL_OK), the value stored in resultVarName is the value returned from script.

       If  the	optionsVarName	argument  is  given, then the variable it names is set to a dictionary of return options returned by evaluation of |
       script.	Tcl specifies two entries that are always defined in the dictionary: -code and -level.	When the return code  from  evaluation	of |
       script  is  not	TCL_RETURN, the value of the -level entry will be 0, and the value of the -code entry will be the same as the return code. |
       Only when the return code is TCL_RETURN will the values of the -level and -code entries be something else, as further described in the doc- |
       umentation for the return command.													   |

       When  the  return  code	from  evaluation  of script is TCL_ERROR, three additional entries are defined in the dictionary of return options |
       stored in optionsVarName: -errorinfo, -errorcode, and -errorline.  The value of the -errorinfo entry is a formatted stack trace	containing |
       more  information  about the context in which the error happened.  The formatted stack trace is meant to be read by a person.  The value of |
       the -errorcode entry is additional information about the error stored as a list.  The -errorcode value is meant to be further processed	by |
       programs,  and may not be particularly readable by people.  The value of the -errorline entry is an integer indicating which line of script |
       was being evaluated when the error occurred.  The values of the -errorinfo and -errorcode entries of the most recent error are also  avail- |
       able as values of the global variables ::errorInfo and ::errorCode respectively. 							   |

       Tcl packages may provide commands that set other entries in the dictionary of return options, and the return command may be used by scripts |
       to set return options in addition to those defined above.

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
	      }

       There are more complex examples of catch usage in the documentation for the return command.

SEE ALSO
       break(n), continue(n), dict(n), error(n), return(n), tclvars(n)

KEYWORDS
       catch, error

Tcl									8.5								  catch(n)
All times are GMT -4. The time now is 04:18 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy