How do I echo one or more tab characters using a bash script? When I run this code
res=\' \'x # res = \"\\t\\tx\" echo \'[\'$res\']\' # expect [\\t\\tx
From the bash man page:
Words of the form $'string' are treated specially. The word expands to string, with backslash-escaped characters replaced as specified by the ANSI C standard.
So you can do this:
echo $'hello\tworld'