質問

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?

役に立ちましたか?

解決

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.

他のヒント

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)

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top