Question about the -c option

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?
Richard W [ Mo, 07 Januar 2008 04:37 ] [ ID #1901396 ]

Re: Question about the -c option

On Mon, 07 Jan 2008 11:37:02 +0800, Richard W <mail4usenet [at] gmail.com> 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/
G_r_a_n_t_ [ Mo, 07 Januar 2008 05:51 ] [ ID #1901397 ]

Re: Question about the -c option

Grant дµÀ:
> On Mon, 07 Jan 2008 11:37:02 +0800, Richard W <mail4usenet [at] gmail.com> 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!
Richard W [ Mo, 07 Januar 2008 07:13 ] [ ID #1901401 ]
Linux » comp.unix.shell » Question about the -c option

Vorheriges Thema: cat help
Nächstes Thema: Why mv have no '-R'