Path: utzoo!attcan!uunet!virtech!cpcahil From: cpcahil@virtech.uucp (Conor P. Cahill) Newsgroups: comp.unix.questions Subject: Re: Using csh commands within the system() function call Keywords: csh sh system Message-ID: <1990Jan13.213312.6620@virtech.uucp> Date: 13 Jan 90 21:33:12 GMT References: <239@tnl.UUCP> Organization: Virtual Technologies Inc. Lines: 28 In article <239@tnl.UUCP>, saf@tnl.UUCP (friedman scott) writes: > I wish to use a system command that works under csh but not under sh within > a system() function call in a C program. The line looks something like this: > > system("command_that_generates_errors >& /dev/null"); You could modify it so that it will work under sh (like the following): system("command_that_generates_errors > /dev/null 2>&1"); or you could fork and execute the program yourself, mapping stdout and stderr to /dev/null. or you could write a new system() like program (maybe csystem()) that forks if child runs csh -c arg_string; waits returns -- +-----------------------------------------------------------------------+ | Conor P. Cahill uunet!virtech!cpcahil 703-430-9247 ! | Virtual Technologies Inc., P. O. Box 876, Sterling, VA 22170 | +-----------------------------------------------------------------------+