09-12-2008
Just as Annihilannic said.
Best use double brackets (most modern shells should support them), which uses the shell instead of invoking "test", whereas it is faster. Round brackets for arithmetic values and square chars/strings etc.
There are the options -n for "not empty" and -z for "zero" for testing which make it more safe to not get the problem you had.
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
Gentlemen,
OK, I have an odd issue here perhaps someone can shed some light for me. When running a script as its user/owner the below pause/wait works just fine. When a developer has used su - to assume the username the pause does not happen... This is a HPUX11.00 machine, I have copied the blurb... (1 Reply)
Discussion started by: Eronysis
1 Replies
2. Programming
Hi,
I have one doubt, in the below program, if I declare char *b inside the main(), the function compiles & runs properly. But at the same time, if I declare it globally it compiles but when we run it, it creates core dump (segmentation fault) both in C & C++. It is not being trapped by catch... (7 Replies)
Discussion started by: royalibrahim
7 Replies
3. Shell Programming and Scripting
i 've noticed the following difference between freebsd cp and gnu cp
from the freebsd cp man page:
-R ... If the source_file ends in a /, the contents of the directory are copied rather than
the directory itself. ...
on gnu cp from the man pagewhile on gnu cp manpage:
‘-r'... (2 Replies)
Discussion started by: aegis
2 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. Ubuntu
I am little bit confused by the behaviour of rm in Ubuntu.
It seems that as a regular user I can delete files owned by another user even when the permissions are set to 644.
Here is an example:
cjohnson@carbon:~/test$ sudo touch testfile
cjohnson@carbon:~/test$ ls -al
total 8
drwxr-xr-x... (2 Replies)
Discussion started by: ccj4467
2 Replies
7. Programming
fg = foreground bg = background
I have a cobol program that I start with a very simple script.
The script is not at fault as it has not changed and the program worked in fg and bg before.
I have altered the logging in the program and moved my cursor declare to working storage.
The program runs... (6 Replies)
Discussion started by: Bruble
6 Replies
8. UNIX for Dummies Questions & Answers
Can someone explain how the below awk simulates cat?
pandeeswaran@ubuntu:~$ awk '1' file
PSAPSR3 3722000 91989.25 2 98
PSAPSR7 1562000 77000.1875 5 95
PSAPUNDO 92000 4087.5625 4 96
pandeeswaran@ubuntu:~$ awk '2' file
PSAPSR3 3722000 91989.25 2 98
PSAPSR7 1562000 77000.1875 5 95
PSAPUNDO... (3 Replies)
Discussion started by: pandeesh
3 Replies
9. Shell Programming and Scripting
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
if ]; then
return 0
fi
Even the if condition fails it returns as zero.. Any clue..
But if i add else condition like
if ]; ... (2 Replies)
Discussion started by: Priya Amaresh
2 Replies
10. Red Hat
Hi Experts,
ps command behavior in Redhat is such that it outputs all the output(of long lengths). In Unix the ps command output was limited to only 80 chars. In that if you pipe its output to another command hen the 80 chars restriction wouldn't be there. This 80 char limitation will only be... (14 Replies)
Discussion started by: Albert_Pinto7
14 Replies
LEARN ABOUT OSF1
pthread_cond_destroy
pthread_cond_destroy(3) Library Functions Manual pthread_cond_destroy(3)
NAME
pthread_cond_destroy - Destroys a condition variable.
LIBRARY
DECthreads POSIX 1003.1c Library (libpthread.so)
SYNOPSIS
#include <pthread.h>
int pthread_cond_destroy(
pthread_cond_t *cond);
STANDARDS
Interfaces documented on this reference page conform to industry standards as follows:
IEEE Std 1003.1c-1995, POSIX System Application Program Interface
PARAMETERS
Condition variable to be destroyed.
DESCRIPTION
This routine destroys the condition variable specified by cond. This effectively uninitializes the condition variable. Call this routine
when a condition variable will no longer be referenced. Destroying a condition variable allows DECthreads to reclaim internal memory asso-
ciated with the condition variable.
It is safe to destroy an initialized condition variable upon which no threads are currently blocked. Attempting to destroy a condition
variable upon which other threads are blocked results in unpredictable behavior.
The results of this routine are unpredictable, if the condition variable specified in cond does not exist or is not initialized.
RETURN VALUES
If an error condition occurs, this routine returns an integer value indicating the type of error. Possible return values are as follows:
Successful completion. The value specified by cond is invalid. The object being referenced by cond is being referenced by another thread
that is currently executing pthread_cond_wait(3) or pthread_cond_timedwait(3) on the condition variable specified in cond.
ERRORS
None
RELATED INFORMATION
Functions: pthread_cond_broadcast(3), pthread_cond_init(3), pthread_cond_signal(3), pthread_cond_timedwait(3), pthread_cond_wait(3)
Manuals: Guide to DECthreads and Programmer's Guide
delim off
pthread_cond_destroy(3)