Экранируемые символы

Простые типы / Символьный тип

#escapes work inside $'…', in plain quotes they stay as they are

#\' for a single quote.
c=$'\''

#\" for a double quote.
c=$'\"'

#\\ for a backslash.
c=$'\\'

#\a for an alert character.
c=$'\a'

#\b for a backspace.
c=$'\b'

#\e for the escape character (it starts the terminal colors).
c=$'\e'

#\n for a new line.
c=$'\n'

#\r for a carriage return.
c=$'\r'

#\t for a horizontal tab.
c=$'\t'

#\v for a vertical tab.
c=$'\v'

#\x for a hexadecimal character code.
c=$'\x41' #Symbol A

#\ and up to three octal digits for an octal code.
octal=$'\101' #Symbol A

#\0, a null character, can not be kept: a bash string ends at it
cut=$'ab\0cd'
#cut is "ab"

#printf %q shows an invisible character as an escape
printf -v shown '%q' $'\t'
#shown is "$'\t'"

echo "c is $c"
echo "octal is $octal"
echo "cut is $cut"
echo "shown is $shown"