On Wed, Mar 21, 2012 at 6:31 PM, suvayu ali <fatkasuvayu+li...@gmail.com> wrote: > Hello Andreas, > > On Wed, Mar 21, 2012 at 15:24, Andreas Marschke > <andreas.marsc...@googlemail.com> 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.