[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: shell-quote-argument escapes '='
From: |
Philipp Stephani |
Subject: |
Re: shell-quote-argument escapes '=' |
Date: |
Fri, 24 Apr 2020 18:13:34 +0200 |
Am Fr., 24. Apr. 2020 um 15:29 Uhr schrieb Stefan Monnier
<monnier@iro.umontreal.ca>:
>
> > (shell-quote-argument "a=b")
> >
> > I get:
> >
> > "a\\=b"
>
> Which is the printed representation of the string that contains
> 4 characters:
>
> a\=b
>
> > That's wrong, because it does not work in Bash:
> >
> > $ echo "a\\=b"
> > a\=b
>
> You're not supposed to put quotes around nor to double the backslash:
>
> $ echo a\=b
> a=b
> $
>
Note that those two aren't the same. The command
a=b
sets the variable 'a' to the string 'b'. The command
a\=b
runs a function/command/binary called 'a=b'. So not quoting = (i.e.
replicating the printf %q behavior) would be a breaking change.