New answers tagged escape-characters
Have you got specific operations in mind? Here is an example of using standout mode, which on many terminals will give a strong visible result: tput smso; echo hello, world; tput rmso If you were to pipe the sequence to, say, cat, the highlighting would become an empty operation because a pipe isn't a device that understands standout mode: ( tput smso; ...
Actually it is possible to inquire DEC terminals (and their clones and emulations, including xterm) about their capabilities; just not about individual escape sequence support (or its completeness). UNIX generally doesn't use this feature, relying on termcap/terminfo databases (which document the quirks as well). For reference, the sequences are DA ...
Use col -b (on Linux it's part of the util-linux package; in base system elsewhere). col filters out reverse (and half-reverse) line feeds so the output is in the correct order, with only forward and half-forward line feeds.
Missed a space: PB_ACL="acl="`echo $IMGREQ | jq -r '.data.acl'` ^
Use od, hexdump, xxd, or similar to print binary data in human-readable form. For example: $ tput setaf 1 | od -c 0000000 033 [ 3 1 m 0000005
Sounds like you want the opposite of printing them literally, you want those escape characters converted to a printable descriptive form like \E or \033, ^[... If it's just the ESC (0x1b) character you want to convert to \E, then with ksh93, zsh or bash (typically, the same ones that also support that non-standard %q), you can do: printf '%s\n' ...
You can use printf directly, eg printf "\033[31mfail"
This has nothing to do with bash, it is purely an effect of the terminal's behavior, specifically scroll. When you reach the bottom of the screen, and start to type on the next line, the terminal creates a new blank line by pushing everything up one line. (In older terminals this destroys the top line. In newer terminals the top line is just pushed into the ...
Top 50 recent answers are included