[Toybox] Inconsistent gnu crap.
Rob Landley
rob at landley.net
Mon Apr 13 10:19:20 PDT 2020
On 4/13/20 12:12 PM, Rob Landley wrote:
> Hmmm... would echo -n '\123' being parsed into hex 53 be a BAD thing? (Right now
> it's passed through as literals but understanding EXTRA escapes shouldn't cause
> too much trouble? The question is whether I preparse to add extra behavior,
> which I'm already doing for \c ending the string early, or whether I need to add
> an extra argument to unescape() to tell it to behave differently in different
> situations. I can easily make it so the rule is "the first leading zero in an
> echo octal escape gets eaten"...)
Sigh:
$ sh -c 'echo "\123"' | hd
00000000 53 0a |S.|
00000002
The echo built into the Defective Annoying SHell is already doing what I was
suggesting. I'm not sure if that's an argument for or against. (I suspect
"against'. Hmmm...)
Then again, the defective annoying shell's built-in echo doesn't understand -e:
$ sh -c 'echo -e "\123"' | hd
00000000 2d 65 20 53 0a
Yeah, dash doing that is definitely an argument _against_ doing it. Hmmm. (I
_might_ do it anyway, but dash doing it definitely makes me reconsider.)
Rob
More information about the Toybox
mailing list