According to man:
If -e is in effect, the following sequences are recognized:
\b backspace
So I would expect echo -e "word\b" to produce wor output. But yet:
$ echo -e "wor\bd"
wod
$ echo -e "word\b"
word
What's the reason behind this?
According to man:
If -e is in effect, the following sequences are recognized:
\b backspace
So I would expect echo -e "word\b" to produce wor output. But yet:
$ echo -e "wor\bd"
wod
$ echo -e "word\b"
word
What's the reason behind this?
Since this can't be marked a duplicate of an SO question, I guess it's valid to put an answer here in U&L.
\b moves the cursor back one character, but it doesn't erase that character. A final character printed would overwrite the character.
$ echo -e "hello world\bX"
hello worlX