Srini
Srini

Reputation: 1639

Bash backspace character correct use

I did a pretty simple thing.

echo -e "123\b4" >> simple
cat simple
124

But when I open this file in Sublime text I get some characters called "BS" which probabvly stands for backspace, and when i open it with gedit I get a space instead and 4 after the space. which is the correct version of the file?

and when I open the file on the commandline with vim I get a

^H

character instead.

Can someone please offer guidance?

Upvotes: 0

Views: 875

Answers (2)

Abhi
Abhi

Reputation: 744

\b simply takes cursor to left by single character. Its upto each editors interpretation to this symbol!

Upvotes: 1

Stefano Falsetto
Stefano Falsetto

Reputation: 572

The correct version of the file is the one saved on the filesystem. Sublime text and gedit are reading the file and representing in different ways.

Upvotes: 5

Related Questions