Source-Changes-D archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: CVS commit: src/bin/echo



    Date:        Tue, 14 May 2024 12:41:51 +0300
    From:        Valery Ushakov <uwe%stderr.spb.ru@localhost>
    Message-ID:  <ZkMx36E0wraZ59DZ%snips.stderr.spb.ru@localhost>

  | Unfortunately that advice is not true without further caveats.

That you have to actually write a valid printf(1) command, and not
simply s/echo/printf/ ?   Does that really need saying?


  | netbsd$ sh -c "printf '-V\n'"

	printf -- -V\\n 

and it will work anywhere - our printf is specially hacked as once
upon a time it took no options, and this kind of thing would work.
Format strings starting with a '-' don't work in general however,
the '--' should be included if the format might begin with a '-'.

Even better would be

	printf -- %s\\n -V

(where the -- is optional here).

kre

aside: I'd use '-V\n' inside "" as well.   But as a sh -c command
string I'd use:

	sh -c 'printf -- -V\\n'




Home | Main Index | Thread Index | Old Index