6 of 14 deleted 1 character in body

There are a lot of ways to do this. The most portable two that I know of are sed and od - they're both POSIX.

printf '\n\r\b\t\033[01;31m' | sed -n l

It does like... read style escapes - C-style.



od is a little more configurable...

printf '\n\r\b\t\033[01;31m' |
od -v -w12 -t c -t a -A n

 \n  \r  \b  \t 033   [   0   1   ;   3   1   m
 nl  cr  bs  ht esc   [   0   1   ;   3   1   m

If you wanna know what all of those options do you can look in man od, but I specify I want two types of escapes - the -t c backslash escapes and the -t a named characters. The -w option used above is not POSIX-specified.

And here's a little shell function that will portably print out the octal values of each byte in its arguments:

proctal() for a do (
    while LC_ALL=C
    printf %o\\n "'${a:?}"
    do a=${a#?}; done
);  done 2>/dev/null