Register
It is currently Fri Nov 28, 2014 6:11 am

one line in an editable field


All times are UTC - 6 hours


Post new topic Reply to topic  [ 5 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: 574
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: 673
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  
 PostPosted: Sat Oct 25, 2014 8:49 am   

Joined: Mon Oct 20, 2014 9:53 am
Posts: 16
there is a tool deploying "ncurses" .
It is called dialog and offers some widgets like Textbox, Progressbar, Date/Time selector and alike. It should already be installed.
List of widgets available:
Code:
  --buildlist   
  --calendar     
  --checklist   
  --dselect     
  --editbox     
  --form         
  --fselect     
  --gauge       
  --infobox     
  --inputbox     
  --inputmenu   
  --menu         
  --mixedform   
  --mixedgauge   
  --msgbox       
  --passwordbox 
  --passwordform
  --pause       
  --prgbox       
  --programbox   
  --progressbox 
  --radiolist   
  --rangebox     
  --tailbox     
  --tailboxbg   
  --textbox     
  --timebox     
  --treeview     
  --yesno


If you want to script the same for DesktopEnvironments then use kdialog if on KDE.
zenity if it is GNOME

Via dbus the InterProcessCommunication tool one can even send commands to other Windows. Use qdbus for this. ( And dbusviewer to learn it.)


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

All times are UTC - 6 hours


Who is online

Users browsing this forum: Bing [Bot] and 10 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:  


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