Re: problem with "<" in linux



On 9 Jul, 21:05, j...@xxxxxxxxxxx (Jens Thoms Toerring) wrote:
Jens Thoms Toerring <j...@xxxxxxxxxxx> wrote:

That's probably the simplest alternative, but then make it
execv( "/bin/sh", "/bin/sh", "-c", "program", "<", "file1" );

Grrr. Now I also forgot '(char *) NULL' as the last argument.
And, of course, it must be the execl() function, execv() would
require an array of arguments instead of a list of arguments.
So make it

execl( "/bin/sh", "/bin/sh", "-c", "program", "<",
"file1", ( char * ) NULL );

Shouldn't that be:

execl( "/bin/sh", "/bin/sh", "-c", "program < file1", NULL );


.