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
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
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
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
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
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
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
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
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
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
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_init
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)