Go Back   HowtoForge Forums | HowtoForge - Linux Howtos and Tutorials > Linux Forums > Programming/Scripts

Do you like HowtoForge? Please consider supporting us by becoming a subscriber.
Reply
 
Thread Tools Display Modes
  #1  
Old 2nd November 2009, 09:50
newtolinux2009 newtolinux2009 is offline
Junior Member
 
Join Date: Nov 2009
Posts: 2
Thanks: 1
Thanked 0 Times in 0 Posts
Angry How to put dialog in a loop in shell script and saving to file

Hi,
I am trying to input data, using dialog, into a file.
I would appreciate help on
1. how to store the input to a file?
2. how to put it in a loop to get a control on how much data is entered
3. pressing ENTER key terminates the dialog - how can I use ENTER key to function same as DOWN ARROW key

here's the code

#!/bin/bash
id=""
name=""
dob=""

exec 3>&1

VALUES=$(dialog --ok-label "Save" \
--title "Add Records" \
--form "Data Capture" \
15 50 0 \
"Identification No:" 1 1 "$id" 1 10 10 0 \
"name:" 2 1 "$name" 2 10 30 0 \
"Dob:" 3 1 "$dob" 3 10 8 0 \
2>&1 1>&3)

exec 3>&-
Reply With Quote
Sponsored Links
  #2  
Old 3rd November 2009, 14:24
falko falko is offline
Super Moderator
 
Join Date: Apr 2005
Location: Lüneburg, Germany
Posts: 41,701
Thanks: 1,900
Thanked 2,722 Times in 2,563 Posts
Default

You can download ISPConfig 2 and take a look at the setup2 script. It has examples for 1 and 2 that should give you the idea.
__________________
Falko
--
Download the ISPConfig 3 Manual! | Check out the ISPConfig 3 Billing Module!

FB: http://www.facebook.com/howtoforge

nginx-Webhosting: Timme Hosting | Follow me on:
Reply With Quote
The Following User Says Thank You to falko For This Useful Post:
newtolinux2009 (5th November 2009)
  #3  
Old 5th November 2009, 13:50
newtolinux2009 newtolinux2009 is offline
Junior Member
 
Join Date: Nov 2009
Posts: 2
Thanks: 1
Thanked 0 Times in 0 Posts
 
Default thanks

thanks
points 1 and 2 are now working fine.
wonder how ENTER key can work as DOWN ARROW key in dialog form?
Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

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 On
HTML code is Off

Forum Jump


All times are GMT +2. The time now is 01:16.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2014, vBulletin Solutions, Inc.