how do I exec() a script

Leif Ljung /DP llj at kps.UUCP
Thu Jun 28 00:43:19 AEST 1990


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 at kps.se||uunet!mcsun!sunic!kps!llj)



More information about the Comp.lang.c mailing list