command [argument ...] in ssh(1): a footgun

Thorsten Glaser t.glaser at tarent.de
Sun May 28 05:09:19 AEST 2023


On Sat, 27 May 2023, Brian Candler wrote:

>> has the effect you want; the first backslash is eaten by the
>> local shell.
>>
> Or is it?
>
> $ echo "ls -l a\ b"
> ls -l a\ b

Ah oops, in POSIX only when followed by [$`"\\\n] of course.
I’m not fond of “loose” backslashes though.

That does not detract from the point, ofc.

> Other shells may be different, of course.

That they do. (Same for echo: that may *also* eat that backslash.
For echo, basically, if the first argument begins with a hyphen-minus
or any argument contains a backslash, its use is not portable.)

bye,
//mirabilos
-- 
Infrastrukturexperte • tarent solutions GmbH
Am Dickobskreuz 10, D-53121 Bonn • http://www.tarent.de/
Telephon +49 228 54881-393 • Fax: +49 228 54881-235
HRB AG Bonn 5168 • USt-ID (VAT): DE122264941
Geschäftsführer: Dr. Stefan Barth, Kai Ebenrett, Boris Esser, Alexander Steeg

                        ****************************************************
/⁀\ The UTF-8 Ribbon
╲ ╱ Campaign against      Mit dem tarent-Newsletter nichts mehr verpassen:
 ╳  HTML eMail! Also,     https://www.tarent.de/newsletter
╱ ╲ header encryption!
                        ****************************************************


More information about the openssh-unix-dev mailing list