Re: [RFD] Combined fork-exec syscall.

From: Richard B. Johnson (root@chaos.analogic.com)
Date: Mon Apr 28 2003 - 09:16:21 EST


On Mon, 28 Apr 2003, Andreas Schwab wrote:

> "Richard B. Johnson" <root@chaos.analogic.com> writes:
>
> |> On Mon, 28 Apr 2003, Andreas Schwab wrote:
> |>
> |> > "Richard B. Johnson" <root@chaos.analogic.com> writes:
> |> >
> |> > |> The following is a "simple popem()', about as minimal as
> |> > |> you can get and have it work.
> |> >
> |> > Except it doesn't.
> |> >
> |> > |> i = 0;
> |> > |> args[i++] = "/bin/sh";
> |> > |> args[i++] = "-c";
> |> > |> args[i++] = strtok((char *)command, " ");
> |> > |> for(; i< NR_ARGS; i++)
> |> > |> if((args[i] = strtok(NULL, " ")) == NULL)
> |> > |> break;
> |>
> |> Yes it does.
>
> $ sh -c echo a b c
>
> $ sh -c 'echo a b c'
> a b c
>
> Not what I call working.
>
> Andreas.

Read the bash documentation `man bash`. The first argument becomes
$0 (the process name), the second becomes $1, etc. Please don't
just keep assuming that I don't know what I'm talking about.

$ sh -c 'ignore echo a b c'
Works fine.

Cheers,
Dick Johnson
Penguin : Linux version 2.4.20 on an i686 machine (797.90 BogoMips).
Why is the government concerned about the lunatic fringe? Think about it.

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Wed Apr 30 2003 - 22:00:29 EST