Question about the -c option

Question about the -c option

am 07.01.2008 04:37:02 von Richard W

Hi everybody,

I'm puzzled about the different result of the following approaches:

# Cannot work
$ bash -c "read n; echo $n"

/* Can work */
execl ("/bin/sh", "sh", "-c", "read n; echo $n", 0);

Why they are different?
Does the option "-c" means noninteractive?
What on earth does noninteractive mean?

Re: Question about the -c option

am 07.01.2008 05:51:35 von G_r_a_n_t_

On Mon, 07 Jan 2008 11:37:02 +0800, Richard W wrote:

>Hi everybody,
>
> I'm puzzled about the different result of the following approaches:
>
> # Cannot work
> $ bash -c "read n; echo $n"

Try single quotes: ~$ bash -c 'read n; echo $n'

Grant.
--
http://bugsplatter.mine.nu/

Re: Question about the -c option

am 07.01.2008 07:13:49 von Richard W

Grant дµÀ:
> On Mon, 07 Jan 2008 11:37:02 +0800, Richard W wrote:
>
>> Hi everybody,
>>
>> I'm puzzled about the different result of the following approaches:
>>
>> # Cannot work
>> $ bash -c "read n; echo $n"
>
> Try single quotes: ~$ bash -c 'read n; echo $n'
>
> Grant.

Thank you very much!