bin:no-ansi*: Use printf for escape byte

I dislike having the raw escape byte in these scripts. Unfortunately
`sed` does not support interpreting it via an escape sequence, so use
printf for that. To remain POSIX compatible use `\033` and not `\e` or
`\x1b` since I couldn't find these in the printf(1p) manpage.
Unfortunately this brings a second layer of escaping.
This commit is contained in:
2025-09-18 23:29:26 +02:00
parent 4f6929bcce
commit 6b866f5474
2 changed files with 2 additions and 2 deletions

View File

@@ -4,4 +4,4 @@
# #
# Remove ANSI escape sequences. # Remove ANSI escape sequences.
env LC_ALL=C sed 's/\[[0-?]*[ -/]*[@-~]//g' env LC_ALL=C sed "$(printf 's/\033\\[[0-?]*[ -/]*[@-~]//g')"

View File

@@ -5,4 +5,4 @@
# Remove ANSI SGR (Select Graphic Rendition) escape sequences, e.g. setting # Remove ANSI SGR (Select Graphic Rendition) escape sequences, e.g. setting
# color or bold font. # color or bold font.
env LC_ALL=C sed 's/\[[0-?]*[ -/]*m//g' env LC_ALL=C sed "$(printf 's/\033\\[[0-?]*[ -/]*m//g')"