Register
It is currently Sat Sep 20, 2014 6:01 pm

one line in an editable field


All times are UTC - 6 hours


Post new topic Reply to topic  [ 4 posts ] 
Author Message
 PostPosted: Thu Jul 31, 2014 1:08 pm   

Joined: Thu Jul 31, 2014 1:00 pm
Posts: 2
hi

i am writing a script witch should output one line to the user in an editable field

if the user presses enter the characters in the field should be read back in a variable.

long time ago i used a external (ncurses like) programm which does exactly this but i cant remember it any more o:|

can something like this done native with bash?


Top
 Profile  
 PostPosted: Thu Jul 31, 2014 8:58 pm   

Joined: Mon Mar 02, 2009 3:03 am
Posts: 547
hi,

Code:
$ read -p prompt: ' -e -i "text" var
prompt: text
press enter after prompt
Code:
$ echo "$var"
text


Top
 Profile  
 PostPosted: Fri Aug 01, 2014 11:08 am   

Joined: Thu Jul 31, 2014 1:00 pm
Posts: 2
thanks!

there was a missing character but this works great!

Code:
read -p 'prompt: ' -e -i 'text' var && echo $var


is there a parameter to enable "vi edit mode" only for this read?


Top
 Profile  
 PostPosted: Sun Aug 17, 2014 9:10 am   
Site Admin
User avatar

Joined: Sun May 15, 2005 9:36 pm
Posts: 667
Location: Des Moines, Iowa
Code:
[crouse@phantom] ~
> read -p 'prompt: ' -e -i 'text' var && echo $var
prompt: textTestme
textTestme


ok, that was pretty interesting. :)


Top
 Profile WWW  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 4 posts ] 

All times are UTC - 6 hours


Who is online

Users browsing this forum: No registered users and 4 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Jump to:  
cron


BashScripts | Promote Your Page Too
Powered by phpBB © 2011 phpBB Group
© 2003 - 2011 USA LINUX USERS GROUP