How to issue a C SHELL command within a C program

Guy Harris guy at auspex.auspex.com
Tue Aug 21 07:28:50 AEST 1990


>This works under SunOS 4.0.3 (and probably others):

It should work on any UNIX system where "/bin/csh" refers to the C
shell.  (If it doesn't, either that system's C shell is broken, its
"system()" implementation is broken, or something either or both of them
use is broken.)

>	system("/bin/csh -c \"<command>\"");
>
>system() calls /bin/sh, which in this case starts a `csh' to perform
><command>.  Note the \" around <command>.

Which means if <command> *itself* contains double-quotes, you have some
more quoting to do....



More information about the Comp.unix.questions mailing list