Perhaps this kind of model serves your purpose.
Every time fork a child process, where it loads the executable with index as argument.
Parent process continues looping on index value.
NOTE: Please use the code tags, when you are exemplifying with code snippets.
I have the following functions but when I run SelectQmgr from a Menu Selection it doesn't do anything.
SelectQmgr ()
{
qmgrlist=`ls /var/mqm/qmgrs/ | grep -v @SYSTEM`
qmgrcount=`ls /var/mqm/qmgrs/ | grep -v @SYSTEM | wc -l`
if
then
echo "$qmgrlist QManager will be used "
... (7 Replies)
Hi,
I compiled with no error a C program, than I tryed to execute it and than I get this error:
connessione al server fallita: Address family not supported by protocol family
What does it mean?
Why I get this error only on Mac os x while on Ubuntu the program works?
The code is:... (3 Replies)
how does exec() do it? on successful call of exec() family of functions, they never return...
how to i emulate that.
assume the standard example,
execl("/bin/ls","ls",NULL);
now this would never return.
i m trying to emulate exec()'s never to return feature...
#include<unistd.h>... (4 Replies)
Hi @ all :)
i made a very little shell script witch is working well when i'm launching it directly
like with ./script
but when i'm launching it by cron tab it work at half only.
the part of the script witch are not working are:
#!/bin/sh
apt-get updade
apt-get -s upgrade >>... (5 Replies)
I have the following files in a directory
> ls -1 /tmp/test/dir/
file with spaces 1.ogg
file with spaces 2.oggI am running the following to echo the filenames but alter the file extension on the files to .mp3 instead of .ogg ( I am going to run ffmpeg against the files ultimately, but keeping... (2 Replies)
I have the following bash script lines in a file named test.sh.
#!/bin/bash
#
# Write Date to cron.log
#
echo "Begin SSI Load $(date +%d%b%y_%T)"
#
# Get the latest rates file for processing.
#
d=$(ls -tr /rms/data/ssi | grep -v "processed" | tail -n 1)
filename=$d
export filename... (3 Replies)
I have 7 functions those need to be executed as command line inputs, I tried with below code it’s not executing function. If I run the ./script 2 then fun2 should execute , how to initiate that function I tried case and if else also, how to initiate function from command line
if
then... (8 Replies)
Hi,
I am studying exec family of functions.Its man page says,it replaces the current process image with a new process image. If it replaces the binary,then after returning back,how does it get the previous parameters of the process which called exec?As replacing process image means replacing all... (1 Reply)
I am creating a menu currently that makes use of functions to complete each selected option but running into a bit of trouble calling them into action still fairly new with using functions correctly so any insight is appreciated. here is my code so far
#!/bin/bash
#Last updated on 05/14/14
... (4 Replies)
# Erroneous question, so can be removed. (0 Replies)
Discussion started by: beginnerboy
0 Replies
LEARN ABOUT SUNOS
system
system(3C)system(3C)NAME
system - issue a shell command
SYNOPSIS
#include <stdlib.h>
int system(const char *string);
The system() function causes string to be given to the shell as input, as if string had been typed as a command at a terminal. The invoker
waits until the shell has completed, then returns the exit status of the shell in the format specified by waitpid(3C).
If string is a null pointer, system() checks if the shell exists and is executable. If the shell is available, system() returns a non-zero
value; otherwise, it returns 0. The standard to which the caller conforms determines which shell is used. See standards(5).
The system() function executes vfork(2) to create a child process that in turn invokes one of the exec family of functions (see exec(2)) on
the shell to execute string. If vfork() or the exec function fails, system() returns -1 and sets errno to indicate the error.
The system() function fails if:
EAGAIN The system-imposed limit on the total number of processes under execution by a single user would be exceeded.
EINTR The system() function was interrupted by a signal.
ENOMEM The new process requires more memory than is available.
USAGE
The system() function manipulates the signal handlers for SIGINT, SIGQUIT, and SIGCHLD. It is therefore not safe to call system() in a mul-
tithreaded process, since some other thread that manipulates these signal handlers and a thread that concurrently calls system() can inter-
fere with each other in a destructive manner. If, however, no such other thread is active, system() can safely be called concurrently from
multiple threads. See popen(3C) for an alternative to system() that is thread-safe.
See attributes(5) for descriptions of the following attributes:
+-----------------------------+-----------------------------+
| ATTRIBUTE TYPE | ATTRIBUTE VALUE |
+-----------------------------+-----------------------------+
|Interface Stability |Standard |
+-----------------------------+-----------------------------+
|MT-Level |Unsafe |
+-----------------------------+-----------------------------+
ksh(1), sh(1), exec(2), vfork(2), popen(3C), waitpid(3C), attributes(5), standards(5)
18 Dec 2003 system(3C)