Sponsored Content
Top Forums Shell Programming and Scripting If condition return 0 even when it fails to satisfy te condition Post 302805295 by vidyadhar85 on Friday 10th of May 2013 01:49:22 AM
Old 05-10-2013
dont use [[ use [ and to group your condition properly put them inside ( )
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

if condition

Hi friends, :) In a shell script i found the following if condition. echo -n "Which version of $1 do you want to restore ('0' to quit)? : " read desired if ${desired:=1} -ge $index ] ; then echo "$0: Restore canceled by user: index value too big." >&2 exit 1 fi Can... (1 Reply)
Discussion started by: ravi raj kumar
1 Replies

2. Shell Programming and Scripting

If Condition

Hi, I am trying to execute this command, but is it not working, says "`;' unexpected" eval $lgrep $SAM_CMD ; if ; then ; echo "No Error" ; fi What i want is, return the command output, if it is non zero, say "No Error". Thanks, John. (21 Replies)
Discussion started by: john_prince
21 Replies

3. Shell Programming and Scripting

Stop execution of script if some condition fails

After my if condtion give rusult true then script should stop execution. Please advice...Thnaks in advance (1 Reply)
Discussion started by: vivek1489
1 Replies

4. HP-UX

Difference between [condition] and [[condition]] and ((condition)) when used with if condition

Executed the following if conditions .. and got different results . only (( )) gave correct o/p with all scenarios . Can anybody please let me know what is the difference between and ] and ((condition)) when used with if condition. And why each condition gave different result. 1.... (2 Replies)
Discussion started by: soumyabubun
2 Replies

5. 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

6. UNIX for Dummies Questions & Answers

If condition fails, advise using wildcard

OS Environment: HP-UX B.11.31 U ia64 I am using the shell script code to connect to Oracle RAC database. Passing the parameter of cluster database name. typeset -l DB_ID=$1 + typeset -l DB_ID=sivDB #---- 3. SetDB validation ------------- if ; then print... (3 Replies)
Discussion started by: Siva SQL
3 Replies

7. Shell Programming and Scripting

compare 2 files and return unique lines in each file (based on condition)

hi my problem is little complicated one. i have 2 files which appear like this file 1 abbsss:aa:22:34:as akl abc 1234 mkilll:as:ss:23:qs asc abc 0987 mlopii:cd:wq:24:as asd abc 7866 file2 lkoaa:as:24:32:sa alk abc 3245 lkmo:as:34:43:qs qsa abc 0987 kloia:ds:45:56:sa acq abc 7805 i... (5 Replies)
Discussion started by: anurupa777
5 Replies

8. Shell Programming and Scripting

How to exit from shell script if above condition fails?

HI cd ${back_home} if above back_home does not exist, then script shoul exit. Please let us know how to do that (7 Replies)
Discussion started by: buzzme
7 Replies

9. Shell Programming and Scripting

Evaluate 2 columns, add sum IF two columns satisfy the condition

HI All, I'm embedding SQL query in Script which gives following output: Assignee Group Total ABC Group1 17 PQR Group2 5 PQR Group3 6 XYZ Group1 10 XYZ Group3 5 I have saved the above output in a file. How do i sum up the contents of this output so as to get following output: ... (4 Replies)
Discussion started by: Khushbu
4 Replies

10. Shell Programming and Scripting

If condition fails for special charecter

I have a sample server name listed in variable as below: var="server-13" I need to check if the 7th character on $var is number 1 whichenv=`echo "$var"| head -c 7 | tail -c 1` if ]; then echo "9 found" else echo "9 Not Found" fi Output: This works... (3 Replies)
Discussion started by: mohtashims
3 Replies
PTHREAD_CONDATTR(3)					     Library Functions Manual					       PTHREAD_CONDATTR(3)

NAME
pthread_condattr_init, pthread_condattr_destroy - condition creation attributes SYNOPSIS
#include <pthread.h> int pthread_condattr_init(pthread_condattr_t *attr); int pthread_condattr_destroy(pthread_condattr_t *attr); DESCRIPTION
Condition attributes can be specified at condition creation time, by passing a condition attribute object as second argument to pthread_cond_init(3). Passing NULL is equivalent to passing a condition attribute object with all attributes set to their default values. The LinuxThreads implementation supports no attributes for conditions. The functions on condition attributes are included only for compli- ance with the POSIX standard. pthread_condattr_init initializes the condition attribute object attr and fills it with default values for the attributes. pthread_con- dattr_destroy destroys a condition attribute object, which must not be reused until it is reinitialized. Both functions do nothing in the LinuxThreads implementation. RETURN VALUE
pthread_condattr_init and pthread_condattr_destroy always return 0. AUTHOR
Xavier Leroy <Xavier.Leroy@inria.fr> SEE ALSO
pthread_cond_init(3). LinuxThreads PTHREAD_CONDATTR(3)
All times are GMT -4. The time now is 01:32 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy