06-01-2002
The status of a child process may be interpreted using the following macros, which are defined in <sys/wait.h> :
WIFEXITED(status)
WEXITSTATUS(status)
and others. Here the status is the integer value returned by the system function.
Example :
ret = WEXITSTATUS ( system ( "command > /dev/null " ) ) ;
a value 0 always means success.
10 More Discussions You Might Find Interesting
1. UNIX for Dummies Questions & Answers
Will UNIX Sytem 5, release 3 run on a Pentium (clock speed 100-200 MHz)?
thanks (5 Replies)
Discussion started by: samklyle
5 Replies
2. Shell Programming and Scripting
hi,
can any one help me to correct this function call.
awk -F "," '{ {first=$1; sec=$2; tro=$3;quat=$4 }
if (tro == "")
{
$3 = search "$file2" "$first" "$file3"
{print $1","$2","$3","$4} }
else
{print $1","$2","$3 $4}}' $file1 > $file
search ()
{ (2 Replies)
Discussion started by: kamel.seg
2 Replies
3. UNIX for Dummies Questions & Answers
I try to run java file on SCO Unix, but my Unix doesn't setup with JDK environment. I go to sun.com to download JDK for SCO Unix, but there is only JDK for HP-UNIX, is it ok for SCO Unix? If it's ok, how can I install it to my Unix after I download? If it's not ok, How can I do to run java file in... (0 Replies)
Discussion started by: wendyz
0 Replies
4. Shell Programming and Scripting
Hi,
I have a string corresponding to a function. How I can call that function without if statement?
Thanks in advance. (4 Replies)
Discussion started by: Zaxon
4 Replies
5. Infrastructure Monitoring
Hello,
I have a problem with package and name space.
require "/Mehran/DSGateEngineLib/general.pl";
use strict;
sub System_Status_Main_Service_Status_Intrusion_Prevention
{
my %idpstatus;
my @result;
&General_ReadHash("/var/dsg/idp/settings",\%idpstatus);
#print... (4 Replies)
Discussion started by: Zaxon
4 Replies
6. Shell Programming and Scripting
Hi foiks
i am unable to find what is wrong in my code
mu functionality is to exit from shell when i give 99 but it is not calling function ext
Could you please correct me.
read option
if ;
then
ext
else
echo "out"
fi
function ext
{
echo "tested 99 and exit... (12 Replies)
Discussion started by: kojo
12 Replies
7. Shell Programming and Scripting
hi,
I want to know how to call a pl sql function testfunction(param1,..) that returns a value and grab that value in a shell variable.
Thnx in advance
---------- Post updated 03-30-10 at 11:58 AM ---------- Previous update was 03-29-10 at 03:49 PM ----------
thnx a lot jim (0 Replies)
Discussion started by: austinhell3_16
0 Replies
8. Shell Programming and Scripting
Below is my script that is function properly per my conditions but I am facing one problem here that is when one function fails then Iy should not check other functions but it calls the other function too So anyone can help me how could i achieve this?
iNOUT i AM GIVING TO THE... (1 Reply)
Discussion started by: rohit22hamirpur
1 Replies
9. Shell Programming and Scripting
Hello All :)
I want to write a shell script to find the file system usage on multiple UNIX servers.
Commands: df -g fsJCAPS
Below script works fine and it displays results on terminal/console. I want to store /redirect output on to local server from where I'm running the script.
... (3 Replies)
Discussion started by: Mohammad Nawaz
3 Replies
10. Programming
Hi, I am complete new to C programming and shell scripting. I just wrote a simple C code to calculate integral using trapezoid rule. I am prompting user to pass me No. of equally spaced points , N , upper and lower limit. My code looks as follows so far:
#include<stdio.h>
#include<string.h>... (2 Replies)
Discussion started by: bjhjh
2 Replies
wait.h(3HEAD) Headers wait.h(3HEAD)
NAME
wait.h, wait - wait status
SYNOPSIS
#include <sys/wait.h>
DESCRIPTION
When a process waits for status from its children using either the wait(3C) or waitpid(3C) function, the status returned can be evaluated
with the following macros, defined in <sys/wait.h>. These macros evaluate to integral expressions. The stat argument to these macros is the
integer value returned from wait() or waitpid().
WCOREDUMP(stat) If the value of WIFSIGNALED (stat) is non-zero, this macro evaluates to a non-zero value if a core image of
the terminated child was created.
WEXITSTATUS(stat) If the value of WIFEXITED(stat) is non-zero, this macro evaluates to the exit code that the child process
passed to _exit() (see exit(2)) or exit(3C), or the value that the child process returned from main.
WIFCONTINUED(stat) Evaluates to a non-zero value if status was returned for a child process that has continued.
WIFEXITED(stat) Evaluates to a non-zero value if status was returned for a child process that terminated normally.
WIFSIGNALED(stat) Evaluates to a non-zero value if status was returned for a child process that terminated due to the receipt
of a signal.
WIFSTOPPED(stat) Evaluates to a non-zero value if status was returned for a child process that is currently stopped.
WSTOPSIG(stat) If the value of WIFSTOPPED(stat) is non-zero, this macro evaluates to the number of the signal that caused
the child process to stop.
WTERMSIG(stat) If the value of WIFSIGNALED(stat) is non-zero, this macro evaluates to the number of the signal that
caused the termination of the child process.
The <sys/wait.h> header defines the symbolic constants listed below for use with waitpid(3C).
WNOHANG Do not hang if no status is available; return immediately.
WUNTRACED Report status of stopped child process.
The symbolic constants listed below are defined as possible values for the options argument to waitid(2).
WEXITED Wait for processes that have exited.
WSTOPPED Status is returned for any child that has stopped upon receipt of a signal.
WCONTINUED Status is returned for any child that was stopped and has been continued.
WNOHANG Return immediately if there are no children to wait for.
WNOWAIT Keep the process whose status is returned in infop in a waitable state.
The type idtype_t is defined as an enumeration type whose possible values include the following:
P_ALL
P_PID
P_PGID
The id_t and pid_t types are defined as described in <sys/types.h>.
The siginfo_t type is defined as described in <signal.h>.
The rusage structure is defined as described in <sys/resource.h>.
Inclusion of the <sys/wait.h> header can also make visible all symbols from <signal.h> and <sys/resource.h>.
ATTRIBUTES
See attributes(5) for descriptions of the following attributes:
+-----------------------------+-----------------------------+
| ATTRIBUTE TYPE | ATTRIBUTE VALUE |
+-----------------------------+-----------------------------+
|Interface Stability |Standard |
+-----------------------------+-----------------------------+
SEE ALSO
exit(2), waitid(2), exit(3C), wait(3C), waitpid(3C),attributes(5), standards(5)
SunOS 5.10 10 Sep 2004 wait.h(3HEAD)