udem-dlteam / pnut

🥜 A Self-Compiling C Transpiler Targeting Human-Readable POSIX Shell
https://pnut.sh
BSD 2-Clause "Simplified" License
425 stars 14 forks source link

Printf "-=" is recognized as an option and not a format string #50

Closed laurenthuberdeau closed 3 months ago

laurenthuberdeau commented 5 months ago

Bug

➜  ksh -E 'printf "-="' 
ksh: printf: -=: unknown option
Usage: printf [ options ] format [string ...]

Escaping the leading - makes it print -= as expected:

➜  ksh -E 'printf "\-="'
-=%

But not on dash, which prints the \:

➜  dash -c 'printf "-="' 
dash: 1: printf: Illegal option -=
➜ dash -c 'printf "\-="'
\-=%