Path: utzoo!utgpu!news-server.csri.toronto.edu!clyde.concordia.ca!uunet!munnari.oz.au!metro!wolfen!hls0!george From: george@hls0.hls.oz (George Turczynski) Newsgroups: comp.unix.questions Subject: Re: How to issue a C SHELL command within a C program Summary: Use system("csh -c ..."); Message-ID: <852@hls0.hls.oz> Date: 17 Aug 90 00:02:40 GMT References: <25279.26c7fd35@kuhub.cc.ukans.edu> Lines: 22 In article <25279.26c7fd35@kuhub.cc.ukans.edu>, jian@kuhub.cc.ukans.edu writes: > How can I issue a statment that executes a C SHELL command within a C program? This works under SunOS 4.0.3 (and probably others): system("/bin/csh -c \"\""); system() calls /bin/sh, which in this case starts a `csh' to perform . Note the \" around . Here is a quick example: main() { system("/bin/csh -c \"/bin/echo This command run by /bin/csh !\""); exit(0); } -- | George P. J. Turczynski. |---------------------------------------------------- | Computer Systems Engineer. | ACSnet: george@highland.oz | I can't speak for the | | Highland Logic Pty. Ltd. | Phone: +61 48 683490 | company, I can barely | | Suite 1, 348-354 Argyle St | Fax: +61 48 683474 | speak for myself... | | Moss Vale. NSW. Australia. 2577 |----------------------------------------------------