[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Bash $@ expansion undocumentedly ignoring '

From: DJ Mills
Subject: Re: Bash $@ expansion undocumentedly ignoring '
Date: Wed, 21 Mar 2012 18:34:11 -0400

On Wed, Mar 21, 2012 at 6:31 PM, suvayu ali <address@hidden> wrote:
> Hello Andreas,
> On Wed, Mar 21, 2012 at 15:24, Andreas Marschke
> <address@hidden> wrote:
>> it has come to my attention that bash is unexpectedly removing quotes
>> from parameters given to a script if read from within the
>> script. See attached shell-script for a full explanation.
> You could have put the explanation in the email, instead of an
> attachment. Its much more convenient that way.
>> This does not constitute that quotations in the passed parameters are
>> to be ignored/removed upon passing them back to the script.
> I believe this is where you are misunderstanding. The quotes are removed
> by the current instance of bash (the shell that you use to invoke the
> script). If you want to pass on the quotes as is, you would need to
> excape them with a backslash.
> $ ./test.sh \'bla \'foo 'bar'
> 'bla 'foo bar
> As you see, the first two quotes are passed on to the script, whereas
> the last two are not.
> Hope this helps.
> --
> Suvayu
> Open source is the future. It sets us free.

Note that the literal quotes are NOT syntactic, they have nothing to
do with having multiple words in an argument.

reply via email to

[Prev in Thread] Current Thread [Next in Thread]