Pergunta

This is the bash statement in question:

xx="$(echo 'a_b' | tr '_' '\t')"

Why is the underscore replaced with a space instead of a tab?

Foi útil?

Solução

It's not. :-)

If you check the result with echo $xx, the tab will be replaced with a space.

Try echo "$xx" (with double-quotes) instead.

Outras dicas

Not directly answering your question, but you can do this in pure Bash:

xx='a_b'
xx="${xx//_/    }"

(where the space in / } is a literal Tab; you may need to use ^v to enter it)

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top