If condition return 0 even when it fails to satisfy te condition
HI
My doubt may be basic one but I need to get it clarified..
When i use "if" condition that checks for many AND, OR logical conditions
like
Even the if condition fails it returns as zero.. Any clue..
But if i add else condition like
It works as expected.. But my doubt is why does if statement alone wont work??
Is it mandatory to add "else" statement in ksh shell whenever "if" is used?
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)
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)
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)
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)
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)
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)
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)
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
LEARN ABOUT HPUX
pthread_condattr_destroy
pthread_condattr_init(3T)pthread_condattr_init(3T)NAME
pthread_condattr_init(), pthread_condattr_destroy() - initialize or destroy a condition variable attributes object.
SYNOPSIS PARAMETERS
attr Pointer to the condition variable attributes object to be initialized or destroyed.
DESCRIPTION
initializes the condition variable attributes object attr with the default values for all attributes. The attributes object describes a
condition variable in detail and is passed to the condition variable initialization function.
When a condition variable attributes object is used to initialize a condition variable, the values of the individual attributes determine
the characteristics of the new condition variable. Attributes objects act like additional parameters to object initialization. A single
attributes object can be used in multiple calls to the function
When a condition variable is initialized with an attributes object, the attributes are, in effect, copied into the condition variable.
Consequently, any change to the attributes object will not affect any previously initialized condition variables. Once all condition vari-
ables needing a specific attributes object have been initialized, the attributes object is no longer needed.
The condition variable attributes and their default values are:
The default value is
If an initialized condition variable attributes object is reinitialized, undefined behavior results.
destroys the condition variable attributes object attr. The destroyed condition variable attributes object ceases to exist and its
resources are reclaimed. Using attr after it has been destroyed results in undefined behavior. A destroyed condition variable attributes
object can be reinitialized using the function
Condition variables that have been already initialized using this attributes object are not affected by the destruction of the condition
variable attributes object.
RETURN VALUE
Upon successful completion, and return zero. Otherwise, an error number is returned to indicate the error (the variable is not set).
ERRORS
If any of the following occur, the function returns the corresponding error number:
[ENOMEM] There is insufficient memory available in which to initialize the condition variable attributes object.
[EINVAL] attr is not a valid condition variable attributes object.
For each of the following conditions, if the condition is detected, the function returns the corresponding error number:
[EINVAL] attr is not a valid condition variable attributes object.
AUTHOR
and were derived from the IEEE POSIX P1003.1c standard.
SEE ALSO pthread_create(3T), pthread_condattr_getpshared(3T), pthread_cond_init(3T).
STANDARDS CONFORMANCE
Pthread Library pthread_condattr_init(3T)