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.
9 lines
233 B
Bash
Executable File
9 lines
233 B
Bash
Executable File
#!/bin/sh
|
|
# SPDX-License-Identifier: MIT
|
|
# Copyright (c) 2025 Julian Prein
|
|
#
|
|
# Remove ANSI SGR (Select Graphic Rendition) escape sequences, e.g. setting
|
|
# color or bold font.
|
|
|
|
env LC_ALL=C sed "$(printf 's/\033\\[[0-?]*[ -/]*m//g')"
|