Path: utzoo!attcan!uunet!cs.utexas.edu!rice!uupsi!sunic!kps!llj From: llj@kps.UUCP (Leif Ljung /DP) Newsgroups: comp.lang.c Subject: how do I exec() a script Message-ID: <661@kps.UUCP> Date: 27 Jun 90 14:43:19 GMT Reply-To: llj@kps.se (Leif Ljung /DP) Organization: Kuwait Petroleum, 'Q8', Stockholm, Sweden Lines: 21 I have a program that I want to do a general exec(2) sometimes executing a binary program, sometimes a shell-script preferably using PATH. Say I have the program `prog' - if this is a script I add the '#! /bin/sh' at the top. Can I exec(2) that? No. The only way I have been able to exec the script is by executing a one-liner containing `#! /bin/sh /path/prog. ' But this is not what I want. Not only is the first line limited in length - 32 chars according to exec(2) - it also requires a secondary file that I do not want, I just want to feed the script itself into /bin/sh using the exec(). Is there a way to do this? The system is a Pyramid running BSD4.3. Any clues? --leif --------------- Leif Ljung, Kuwait Petroleum, Stockholm, SWEDEN (llj@kps.se||uunet!mcsun!sunic!kps!llj)