Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Mailing Lists -> Oracle-L -> Re: OT: How to call unix shell scripts from 'C'?

Re: OT: How to call unix shell scripts from 'C'?

From: Tim Gorman <tim_at_sagelogix.com>
Date: Wed, 22 Oct 2003 08:14:31 -0800
Message-ID: <F001.005D3F9C.20031022081431@fatcity.com>


If you want the "C" program and the spawned shell script to "interact" and communicate back and forth with each other, then you'd have to use the "pipe()" system call to set up a two-way interprocess-communication pipe in the "C" program, then call "fork()" to spawn a new identical process (including the IPC pipes), then finally "exec()" in the child process to bring the image of the desired shell running it's shell script in. Of course, each port of "C" has variations on those basic function call (i.e. "exec()" can be "execv()", "execve()", "execle()", etc).

If you're just going to have the "C" program spawn the shell script that will operate independently of its parent, you can just call the "system()" library call and be done with it...

Hope this helps...

-Tim

> The unix and C forums are pretty inactive. Hope its ok to
> ask this here.
> Anyone know how to do this?
>
> --
> Please see the official ORACLE-L FAQ:
> http://www.orafaq.net --
> Author: <rgaffuri_at_cox.net
> INET: rgaffuri_at_cox.net
>
> Fat City Network Services -- 858-538-5051
> http://www.fatcity.com San Diego, California --
> Mailing list and web hosting services
> ----------------------------------------------------------
> ----------- To REMOVE yourself from this mailing list,
> send an E-Mail message to: ListGuru_at_fatcity.com (note
> EXACT spelling of 'ListGuru') and in the message BODY,
> include a line containing: UNSUB ORACLE-L (or the name of
> mailing list you want to be removed from). You may also
> send the HELP command for other information (like
> subscribing).

-- 
Please see the official ORACLE-L FAQ: http://www.orafaq.net
-- 
Author: Tim Gorman
  INET: tim_at_sagelogix.com

Fat City Network Services    -- 858-538-5051 http://www.fatcity.com
San Diego, California        -- Mailing list and web hosting services
---------------------------------------------------------------------
To REMOVE yourself from this mailing list, send an E-Mail message
to: ListGuru_at_fatcity.com (note EXACT spelling of 'ListGuru') and in
the message BODY, include a line containing: UNSUB ORACLE-L
(or the name of mailing list you want to be removed from).  You may
also send the HELP command for other information (like subscribing).
Received on Wed Oct 22 2003 - 11:14:31 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US