Skip to main content
1 of 4
Petr Skocik
  • 29.6k
  • 18
  • 90
  • 154

You can output a character that's not a whitespace after the normal output and then strip it:

f(){ s=$(printf "%sX" "$1"); s=${s%X}; printf "Captured: %q\n" "$s"; } 
Petr Skocik
  • 29.6k
  • 18
  • 90
  • 154