[Info-vax] Command Line Versus Command Line

Arne Vajhøj arne at vajhoej.dk
Fri May 24 21:11:27 EDT 2024


On 5/24/2024 8:58 PM, Arne Vajhøj wrote:
> On 5/24/2024 8:42 PM, Lawrence D'Oliveiro wrote:
>> On Fri, 24 May 2024 20:27:38 -0400, Arne Vajhøj wrote:
>>> On 5/24/2024 8:20 PM, Lawrence D'Oliveiro wrote:
>>>> On Fri, 24 May 2024 19:05:40 +0300, Michael S wrote:
>>>>> Conversion is actually trivial - dumb double-quoting.
>>>>
>>>> What do you do if the value has quotes?
>>>
>>> 1 double-quote -> 2 double-quotes
>>
>> Assuming the receiving end implements the same convention. Otherwise you
>> have trouble.
> 
> ????
> 
> The receiving end does not see any of the added double quotes.

Windows use ' -> "" and Linux (bash) use " -> \".

But receiver does not see any of it.

Windows:

C:\Work\Python>type arg.py
from sys import argv

for i in range(len(argv)):
     print('%d : %s' % (i, argv[i]))

C:\Work\Python>python arg.py a "b c" "d""e"
0 : arg.py
1 : a
2 : b c
3 : d"e

Linux:

arne at arnepc6:~$ cat arg.py
from sys import argv

for i in range(len(argv)):
     print('%d : %s' % (i, argv[i]))
arne at arnepc6:~$ python3 arg.py a "b c" "d\"e"
0 : arg.py
1 : a
2 : b c
3 : d"e

Arne




More information about the Info-vax mailing list