Sample Header Ad - 728x90

Escape control characters in bash script

1 vote
2 answers
237 views
I need a solution to escape control characters from a string. What I need is to turn this: %f4^rH13#b$rHN into this: %f4\^rH13\#b\$rHN I found a solution working with GNU sed on stackoverflow , which won't work on vanilla macOS. I also found a solution to escape ever character on macOS . But I haven't found a solution to only escape control characters.
Asked by Nils (141 rep)
Apr 8, 2023, 01:48 PM
Last activity: Apr 8, 2023, 03:00 PM