LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 04-02-2013, 06:49 AM   #16
jags1984
Member
 
Registered: Mar 2013
Posts: 83

Original Poster
Rep: Reputation: Disabled

Thanks



Code:
read -re -p "some_text" ch
This i tried but when the user edits the whole word that he enetered and comes to the first character and presses left arrow key it starts moving to the left most part and over writes the screen display.

Last edited by jags1984; 04-02-2013 at 06:50 AM.
 
Old 04-02-2013, 09:39 PM   #17
Kenhelm
Member
 
Registered: Mar 2008
Location: N. W. England
Distribution: Mandriva
Posts: 360

Rep: Reputation: 170Reputation: 170
I can't reproduce your problem; adding '-p "some_text"' cured the overwriting on my system.
I tested it on Mageia2 with Bash 4.2.37 on these terminals :-
konsole
mrxvt
xterm
virtual console (obtained with Ctrl+Alt+function key)

This is the script used for the test
Code:
#!/bin/bash
tput cup 2 20
read -re -p "1.Name :" ch
echo "$ch"
 
1 members found this post helpful.
Old 04-02-2013, 11:34 PM   #18
jags1984
Member
 
Registered: Mar 2013
Posts: 83

Original Poster
Rep: Reputation: Disabled
Code:
#!/bin/bash
clear
tput cup 2 20
read -re -p "1.Name :" ch
echo "$ch"

Type some text on the screen say "Apple" now move the left arrow key to character 'A' and start typing some other word say "Ball" now again u press the left arrow key on Character 'B' and satrting editing it the cursor will move to the leftmost postion.Keep u r left arrow key pressing while modifying.

My screen looks something like this



cballAppleame :cccccballApple

Last edited by jags1984; 04-02-2013 at 11:36 PM.
 
Old 04-03-2013, 09:28 PM   #19
Kenhelm
Member
 
Registered: Mar 2008
Location: N. W. England
Distribution: Mandriva
Posts: 360

Rep: Reputation: 170Reputation: 170
I still can't reproduce your problem though I've found two other ways of getting the code to fail on my system.
1. If a letter key is rapidly alternated about a dozen times with the left arrow key.
2. If a long string is typed in which wraps onto the line below and then the backspace key is used to delete it.

Both problems disappear if read is positioned at column 0. It seems read -e does not work very well when used in the middle of a line.

Perhaps you should try changing your three line display into a six line display:-
1.Name :
Some name
2.Address :
Some address
3.Phone :
Some number

It still won't be a foolproof way of entering text because if someone types in a very long name it will wrap onto the line below and overwrite the '2.Address :' prompt.
Using something like Xdialog, Zenity or Kdialog could give better results.
Xdialog has a --3inputsbox option for entering three fields of texts.
http://xdialog.free.fr/doc/box.html
 
1 members found this post helpful.
Old 04-03-2013, 11:19 PM   #20
jags1984
Member
 
Registered: Mar 2013
Posts: 83

Original Poster
Rep: Reputation: Disabled
Thanks for answering my questions.


Looks like i have redesign everything now.

Thankyou
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Left and Right arrow keys do not work on Fedora 16 x64 KDE Janek566 Fedora 2 02-10-2012 06:21 AM
screen / screenrc: how to use the right / ctrl arrow to go left and right in windows? frenchn00b Linux - General 6 11-10-2009 01:11 PM
holding down left and down arrow does not repeat dave201 Linux - General 1 11-22-2008 04:19 PM
Shift-arrow and Alt-arrow keys don't work in xterm Aviv Hurvitz Linux - General 2 09-30-2006 03:43 PM
arrow keys in vi insert mode sanjeev.naik Linux - Software 6 09-04-2004 12:21 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 05:25 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration