bat -pp
Adds Non-Printable Characters, Making it Incompatible with cat
#3004
Labels
bug
Something isn't working
What steps will reproduce the bug?
What happens?
These non-printable characters are added:
␛[38;2;251;241;199m
and␛[0m
.This causes a bunch of issues when trying to use an alias such as
alias cat="bat -pp"
because when usingcat
to, for example, put the contents of a file in a variable, the text content is contaminated by these characters. This causes a many of scripts and functions to either break of have the wrong output.For example, the following script fails:
the output is as follows (note that the path
~/Downloads
exists and can be accessed withchdir ~/Downloads
):What did you expect to happen instead?
The output of
bat -pp
should be clean; i.e. exempt from any formatting. In its current state,bat
cannot be used to replacecat
as it does not output truly plain text.My current workaround is as follows:
How did you install
bat
?homebrew:
brew install bat
bat version and environment
Software version
bat 0.24.0
Operating system
macOS 14.4.1 (Darwin 23.4.0)
Command-line
Environment variables
System Config file
Could not read contents of '/etc/bat/config': No such file or directory (os error 2).
Config file
Custom assets metadata
Custom assets
Compile time information
Less version
The text was updated successfully, but these errors were encountered: