echo backspace


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting echo backspace
# 1  
Old 12-11-2010
echo backspace

Hello Forum:

I am trying to find a meaning to this echo escape character:
Code:
echo -e "\b"

Can someone tell me or give me examples of the effect that this has when used. I know that \b is the backspace, but I cannot visualise it use like any other escape such as:
Code:
echo -e "\n"

Thanks.
--Willie

Last edited by Scott; 12-12-2010 at 04:39 AM..
# 2  
Old 12-11-2010
Code:
$ echo -e '12345\b6'
12346

# 3  
Old 12-11-2010
Thanks Scrutinizer.

Any others?
# 4  
Old 12-11-2010
Like how carriage returns return the carriage, like how new lines cause a new line, back space moves the cursor back one space. It does not erase, just moves the cursor. This behavior happens wholly within the terminal, backspace is still just another character as far as any programs are concerned:

Code:
$ echo -e '12345\b6' | hexdump -C
00000000  31 32 33 34 35 08 36 0a                           |12345.6.|
00000008
$

That's really all there is to it.

Last edited by Corona688; 12-11-2010 at 10:37 PM..
# 5  
Old 12-11-2010
Further to Corona688.

The settings in "stty -a" matter.

On a conventional DEC vtxx terminal (or emulator) this unix command will turn the backspace key into a destructive erase key.
Code:
stty erase "^H"

# 6  
Old 12-11-2010
Thanks methyl.

I believe this might be one of the most abstract escape characters, in my opinion.

--Willie

---------- Post updated at 09:53 PM ---------- Previous update was at 09:52 PM ----------

Thanks Corona688.

Thanks for your time guys.


--Willie
# 7  
Old 12-11-2010
It's all abstract. What makes moving back more abstract than moving forward, down, or to the beginning of the line?
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Echo backspace in spinner script

Trying to insert a backspace for echo. while true ; do i='-\|/' for j in 1 2 3 4 do echo -ne "$(echo ${i} | cut -c${j})" sleep 1 done done this currently outputs: -\|/-\|/-\|/-\| .....etc ---------- Post updated at 02:34 PM ---------- Previous update was at 02:10 PM... (7 Replies)
Discussion started by: squrcles
7 Replies

2. Shell Programming and Scripting

Using backspace in echo to show process count

i have something like this tablesName="abc def hij akn ... etc etc" count=0 for i in $tablesName do echo -en "\b\b\b\b\b\b\b\b\b\b\b\b\bTableCount: $count" count=`expr $count + 1` done the above is just a description wha i need is when the loop executes the... (1 Reply)
Discussion started by: vivek d r
1 Replies

3. Solaris

[SOLVED] Backspace not working!!!!!

Hi friends, Hope u r doing well. It is a very strange problem that I've never faced when I used linux or freebsd. When a type a command in Solaris 10, and if I make a mistake, the backspace doesn't work, when I press the backspace key three times forexample, this is what I get, ^H ^H ^H. The same... (2 Replies)
Discussion started by: gabam
2 Replies

4. UNIX Desktop Questions & Answers

backspace in vi search

Hi gurus, i use vi editor. when I want search something I Type / (or ? if i want search backward), that is OK. But when i make mistake in searching string how can i delete character ? I tried bacskpase but did not work (gives just strange characters). Also tried shift+bacskspace but this only... (3 Replies)
Discussion started by: wakatana
3 Replies

5. UNIX for Dummies Questions & Answers

how to test for backspace

Hi all, I am using a script which is as follows: It reads a character. I want to check if the character is a backspace character or some other character. read -n 1 x if ; then echo "backspace detected" else echo "some other character" fi Thanks in advance. (1 Reply)
Discussion started by: anandkumar
1 Replies

6. Solaris

Using backspace in solaris - help

Hi In solaris if i have to delete something from shell i need to use ctrl+H, coz if i use backspace it shows ^?. Can any one please tell me how to set backspace key so that i can delete any character directly instead of using Ctrl+h. Second Q is like in linux for going to recent command, i... (10 Replies)
Discussion started by: sarbjit
10 Replies

7. Shell Programming and Scripting

equivalent of backspace in ksh

Hello All, What would be the equivalent of backspace key in the korn shell. My scenario is: I am trying to install a product..and it comes out with a Licence Agreement screen, When I manually enter backspace key..I am able to get out of the whole agreement message to a point to type Agree A) or... (2 Replies)
Discussion started by: solaix14
2 Replies

8. UNIX for Dummies Questions & Answers

Control + h and Backspace

Hello, I am a UNIX newbie. With that out of that way.. In order to delete a mistyped character, I need to press control+h to move the cursor to the left, and then overwrite it. If I try hitting the backspace key, it just brings me to a new prompt. Is there a way to change it so that my... (1 Reply)
Discussion started by: martinp973
1 Replies

9. UNIX for Dummies Questions & Answers

Backspace erasing the prompt

My AIX has Korn Shell. I had set the prompt by providing assigning to PS1. If on the prompt I use backspace it erase the whatever appeared due to PS1. Can someone tell me how to forbid this erasing of prompt string, with this behaviour? Thanks in advance. (4 Replies)
Discussion started by: videsh77
4 Replies

10. UNIX for Dummies Questions & Answers

Cannot backspace on my session in CRT

Hi, when I make a mistake and then try to backspace I am unable to do so . Can someone please suggest How I can correct this on my session For Eg: pwd^H^H^H Thanks rooh (2 Replies)
Discussion started by: rooh
2 Replies
Login or Register to Ask a Question