Re: OT: How to call unix shell scripts from 'C'?
Hi Ryan, You could try the Unix shell compiler at http://www.datsi.fi.upm.es/~frosal/ which doesn't actually compile the shell script but generates C and then the standard C compiler does the rest. maybe write in shell with mv's and compile to C and see if it looks efficient? hope this helps kind regards Pete In article [EMAIL PROTECTED], [EMAIL PROTECTED] writes 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 -- Pete Finnigan email:[EMAIL PROTECTED] Web site: http://www.petefinnigan.com - Oracle security audit specialists Book:Oracle security step-by-step Guide - see http://store.sans.org for details. -- Please see the official ORACLE-L FAQ: http://www.orafaq.net -- Author: Pete Finnigan INET: [EMAIL PROTECTED] 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: [EMAIL PROTECTED] (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).
Re: OT: How to call unix shell scripts from 'C'?
Ah, then what you really need to do this with is perl. Edit in place, make backup copies or not, all very simple. eg. change all instances of SQLServer to Oracle in the files in a directory perl -pi -e 's/SQLServer/Oracle/goi' * Jared Ryan [EMAIL PROTECTED] Sent by: [EMAIL PROTECTED] 10/22/2003 08:59 PM Please respond to ORACLE-L To:Multiple recipients of list ORACLE-L [EMAIL PROTECTED] cc: Subject:Re: OT: How to call unix shell scripts from 'C'? 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 [EMAIL PROTECTED] 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: [EMAIL PROTECTED] INET: [EMAIL PROTECTED] 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: [EMAIL PROTECTED] (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: [EMAIL PROTECTED] 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: [EMAIL PROTECTED] (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: [EMAIL PROTECTED] 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: [EMAIL PROTECTED] (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).
Re: OT: How to call unix shell scripts from 'C'?
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: [EMAIL PROTECTED] INET: [EMAIL PROTECTED] 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: [EMAIL PROTECTED] (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: [EMAIL PROTECTED] 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: [EMAIL PROTECTED] (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).
Re: OT: How to call unix shell scripts from 'C'?
fork() and exec() are what you're looking for. I haven't done it in a while, but you should be able to find plenty of info online. On Wed, 2003-10-22 at 11:44, [EMAIL PROTECTED] wrote: 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 Richard Quintin, DBA Information Systems Computing, DBMS Virginia Tech -- If my hands are fully occupied in holding on to something, I can neither give nor receive. -- Dorothee Solle -- Please see the official ORACLE-L FAQ: http://www.orafaq.net -- Author: Quintin, Richard INET: [EMAIL PROTECTED] 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: [EMAIL PROTECTED] (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).
RE: OT: How to call unix shell scripts from 'C'?
Title: RE: OT: How to call unix shell scripts from 'C'? If it is just a simple script call use system(/home/me/myscript); Be careful, your env vars might not be what you expect them to be. -Original Message- From: Quintin, Richard [mailto:[EMAIL PROTECTED]] Sent: Wednesday, October 22, 2003 11:35 AM To: Multiple recipients of list ORACLE-L Subject: Re: OT: How to call unix shell scripts from 'C'? fork() and exec() are what you're looking for. I haven't done it in a while, but you should be able to find plenty of info online. On Wed, 2003-10-22 at 11:44, [EMAIL PROTECTED] wrote: 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 Richard Quintin, DBA Information Systems Computing, DBMS Virginia Tech -- If my hands are fully occupied in holding on to something, I can neither give nor receive. -- Dorothee Solle -- Please see the official ORACLE-L FAQ: http://www.orafaq.net -- Author: Quintin, Richard INET: [EMAIL PROTECTED] 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: [EMAIL PROTECTED] (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). The information contained in this communication, including attachments, is strictly confidential and for the intended use of the addressee only; it may also contain proprietary, price sensitive, or legally privileged information. Notice is hereby given that any disclosure, distribution, dissemination, use, or copying of the information by anyone other than the intended recipient is strictly prohibited and may be illegal. If you have received this communication in error, please notify the sender immediately by reply e-mail, delete this communication, and destroy all copies. Corporate Systems, Inc. has taken reasonable precautions to ensure that any attachment to this e-mail has been swept for viruses. We specifically disclaim all liability and will accept no responsibility for any damage sustained as a result of software viruses and advise you to carry out your own virus checks before opening any attachment.
Re: OT: How to call unix shell scripts from 'C'?
Quintin, Richard wrote: fork() and exec() are what you're looking for. I haven't done it in a while, but you should be able to find plenty of info online. On Wed, 2003-10-22 at 11:44, [EMAIL PROTECTED] wrote: The unix and C forums are pretty inactive. Hope its ok to ask this here. Anyone know how to do this? -- Acutually, there is simpler than this. If the script echoes nothing, system() can be used. Otherwise, look for popen(). -- Regards, Stephane Faroult Oriole Software -- Please see the official ORACLE-L FAQ: http://www.orafaq.net -- Author: Stephane Faroult INET: [EMAIL PROTECTED] 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: [EMAIL PROTECTED] (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).
Re: OT: How to call unix shell scripts from 'C'?
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 [EMAIL PROTECTED] 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: [EMAIL PROTECTED] INET: [EMAIL PROTECTED] 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: [EMAIL PROTECTED] (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: [EMAIL PROTECTED] 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: [EMAIL PROTECTED] (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: [EMAIL PROTECTED] 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: [EMAIL PROTECTED] (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).