09-03-2002
In most languages, using the = sign in a test statement will simply test whether some number is able to be stored in the variable... resulting in an answer of TRUE and the variable being changed.
Also, I haven't seen "test" be used all by itself. I have seen it be used like:
if test intA -eq intB; then ...
but the brackets are shorter:
if [ intA -eq intB ]; then ...
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
I have the code below. I want to said
If TrackErrors > 0 or count == 0
then
MailErrors
else
MailSuccess
fi.
if
then
MailErrors ${count}
else
MailSuccess ${count}
fi
Any helps greatly appreciated. (2 Replies)
Discussion started by: leemjesse
2 Replies
2. Shell Programming and Scripting
Hi all,
I got some problems on executing the following scripts.
Scripts:
if ]; then
echo "M${str}O 0 1" >> ${tempFile}
elif ]; then
echo "M${str}O 1 0" >> ${tempFile}
else
echo "M${str}O 0 0" >> ${tempFile}
fi
Error:
"`;' is not expected."
what's the problem? (2 Replies)
Discussion started by: Rock
2 Replies
3. Shell Programming and Scripting
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
4. Shell Programming and Scripting
I want to know the if condition in checking the hostname in unix and then running a cron job (all in a single line)
Thanks (2 Replies)
Discussion started by: prash358
2 Replies
5. Shell Programming and Scripting
Hi all,
I have a file which I want to split into several files based on a condition. This files has several records. I want one record per file. Each record ends with a //. So, I want to separate files based on this condition. I want split files to be named with the name across the field ID (for... (2 Replies)
Discussion started by: kaav06
2 Replies
6. Shell Programming and Scripting
i have a script where i have to find the age of a file,
if
then
echo "dnb file is present for the monthly load" >> $RUNLOG
dnb="1"
else
echo "dnb file has not arrived yet" > $ERRLOG
dnb="0"
fi
i know the file is available so... (3 Replies)
Discussion started by: lovelysethii
3 Replies
7. Shell Programming and Scripting
i have this code
for i in `cat sql_output.txt`
do
-- some script commands
done
sql_output.txt has 1 column with employee_ids
If the sql_output.txt is null then the do loop should not execute.
How can i implement this.
for i in `cat sql_output.txt`
If i is null or empty
then ... (5 Replies)
Discussion started by: rafa_fed2
5 Replies
8. Shell Programming and Scripting
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
9. UNIX for Advanced & Expert Users
Hi All,
I have already code to create folder for one country let say US , now we want to create folder/directory for JP country also using shell script , application server.
$COUNTRY='US'
if ]
then
if mkdir -m 777 -p /opt/TEST/$COUNTRY/$INVOICE >/dev/null 2>&1 | tee -a ... (5 Replies)
Discussion started by: Boost
5 Replies
10. Shell Programming and Scripting
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
LEARN ABOUT HPUX
pthread_cond_destroy
pthread_cond_init(3T) pthread_cond_init(3T)
NAME
pthread_cond_init(), pthread_cond_destroy() - initialize or destroy a condition variable
SYNOPSIS
PARAMETERS
cond Pointer to the condition variable to be initialized or destroyed.
attr Pointer to the attributes object that defines the characteristics of the condition variable to be initialized. If the
pointer is NULL, default attributes are used.
DESCRIPTION
The function initializes the condition variable cond with the attributes attr. If attr is NULL, the default condition variable attributes
are used to initialize the attributes object. See pthread_condattr_init(3T) for a list of the default condition variable attributes.
After successful initialization, the condition variable may be used in condition variable operations. A condition variable should be ini-
tialized only once or the resulting behavior is undefined. The function provides a way to ensure that a condition variable is only ini-
tialized once.
The macro can be used to initialize condition variables that are statically allocated. These condition variables will be initialized with
default attributes. The function does not need to be called for statically initialized condition variables.
If the process-shared attribute in the condition variable attributes object referenced by attr is defined as the condition variable must be
allocated such that the processes sharing the condition variable have access to it. This may be done through the memory-mapping functions
(see mmap(2)) or the shared memory functions (see shmget(2)).
destroys the condition variable cond. This function may set cond to an invalid value. The destroyed condition variable can be reinitial-
ized using the function If the condition variable is used after destruction in any condition variable call, the resulting behavior is unde-
fined.
A condition variable should be destroyed only when there are no threads currently blocked on it. Destroying a condition variable that is
currently in use results in undefined behavior.
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:
The system does not have the available resources (other than memory)
to initialize the condition variable.
The specified condition variable is an already initialized condition
variable. However, getting for reinitializing the condition variable cannot be expected all the time since the
behavior of reinitializing the condition variable is undefined.
The cond parameter points to an illegal address.
The value specified by
cond or attr is invalid.
There is insufficient memory available in which to initialize
the condition variable.
If any of the following occur, the function returns the corresponding error number:
An attempt to destroy
cond while it is in use by another thread.
cond is not a valid condition variable.
WARNINGS
The space for condition variable must be allocated before calling Undefined behavior will result if the process-shared attribute of attr is
and the space allocated for the condition variable is not accessible to cooperating threads.
AUTHOR
and were derived from the IEEE POSIX P1003.1c standard.
SEE ALSO
pthread_cond_signal(3T), pthread_cond_wait(3T).
STANDARDS CONFORMANCE
Pthread Library pthread_cond_init(3T)