exec() with executable shell scripts

Martin Foord martin at mqcomp.oz
Thu Apr 20 16:37:47 AEST 1989


Everytime I seem to exec() a shell script that is executable I have problems
(execepting if I use execlp() or execvp()).
For example, the program (where /bin/true is an executable shell script) :

% cat foo.c
#include <stdio.h>

char *arg="true";

main()
{
	char *args[2];

	args[1]=arg;
	args[2]=NULL;
	execv("/bin/true",args);
	printf("Can't execute process\n");
}
% foo
Can't execute process

	Why is this ? Is it because /bin/true is a shell script because
othere executable non-shell scripts work fine.

maf.



More information about the Comp.unix.wizards mailing list