I've written a wrapper script that I alias to
cat, called safecat, that protects me from accidentally
cating binaries and getting a ton of screeching from my PC speaker. Right now it considers a file to be binary and will refuse to cat it if 30% or more of the characters within the first page are non-text characters (ASCII range 32-127 and
It just occurred to me that I really don't have any problem with catting a binary so long as I don't get the screeching and my terminal isn't messed up afterwards. Is there a set of characters or character sequences that I can specifically look for and refuse to cat if those are present? That would be more robust.