Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!swrinde!zaphod.mps.ohio-state.edu!rpi!bu.edu!dartvax!eleazar.dartmouth.edu!finn From: finn@eleazar.dartmouth.edu (Andy Behrens) Newsgroups: comp.unix.questions Subject: Re: Interfacing C Code to Shell Script Message-ID: <22413@dartvax.Dartmouth.EDU> Date: 31 May 90 00:59:26 GMT References: <23487@adm.BRL.MIL> Sender: news@dartvax.Dartmouth.EDU Reply-To: andyb@coat.com Lines: 16 rose@baby.swmed.utexas.edu (Rose Oguz) writes: > I want to call a shell script from my C program. However, I > would like the script to return values to my C program. Is there a > way to do this? Or must I write the shell output to a file and read the > contents of the file in my C code? If you need to return a lot of information, then popen(3) is just the thing (as another poster has suggested). However, sometimes you only need to return a small integer, perhaps a success/failure code. If that's the case, it's easier to call system(3), and use the shell command exit N to return your status.