Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: zsh adding single quotes as it pleases



> "Jerry Rocteur" wrote:
>> Given a text file like this:
>>
>> cat ll.txt
>> -a p1vkg/Bis1234/"XXXXXXXX XXXXXXX XX"
>> -a r0esmm/Bis1234/"XXX XXX - XXXX"
[[ deleted ]]
>> Gives me
>>
>> [113] + echo -a 'p1vkg/Bis1234/"XXXXXXXX' XXXXXXX 'XX"'
>> -a p1vkg/Bis1234/"XXXXXXXX XXXXXXX XX"
>> [113] + read line
>> [113] + set -x
>> [113] + echo -a 'r0esmm/Bis1234/"XXX' XXX - 'XXXX"'
>> -a r0esmm/Bis1234/"XXX XXX - XXXX"
>> [113] + read line
>>
>> zsh is adding single quotes..
>
> You mean the quotes in the set -x output?  The real question is why you
> expect or need that to be different.

I was running a java command line which works well when you type it into the command line. As soon as you put it in a
script it works as if the double quotes were not there .. I run it from a Perl script and it works well.

So I decided to stick the set -x to see what was happening and saw the single quote.

The Java expects to see the line like this:

-a p1vkg/Bis1234/"XXXXXXXX XXXXXXX XX"

If it does not get it exactly like this it fails.. And it fails when I run it the way I describe above.

>> Why does it do that ?
>
> $line contains:
>
> -a p1vkg/Bis1234/"XXXXXXXX XXXXXXX XX"
>
> In ksh mode, this gets split into words on spaces when used as a command
> argument, i.e the words:
>
> -a
> p1vkg/Bis1234/"XXXXXXXX
> XXXXXXX
> XX"

It looks like this is not going to work this way, we will have to do it differently.

Thanks everyone, we'll work around it..

Jerry



Messages sorted by: Reverse Date, Date, Thread, Author