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: Ryan <rgaffuri_at_cox.net>
Date: Wed, 22 Oct 2003 19:59:26 -0800
Message-ID: <F001.005D401A.20031022195926@fatcity.com>


the basics are they i want 'C' so i can use a file pointer. I need to do some search and replace in a group of files. If I use straight scripting I have to redirect the output to a new file and do a 'mv' to rename it back.

with the filepointer, I was hoping to be to use fopen in C to open the file and then manipulate it with search and replace.

not sure its possible. I Think you run into the same 'random access' issues you do in java. im pretty weak in C programming. ----- Original Message -----
To: "Multiple recipients of list ORACLE-L" <ORACLE-L_at_fatcity.com> Sent: Wednesday, October 22, 2003 12:14 PM

> 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).
>

-- 
Please see the official ORACLE-L FAQ: http://www.orafaq.net
-- 
Author: Ryan
  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).
Received on Wed Oct 22 2003 - 22:59:26 CDT

Original text of this message

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