How to put dialog in a loop in shell script and saving to file

Discussion in 'Programming/Scripts' started by newtolinux2009, Nov 2, 2009.

  1. newtolinux2009

    newtolinux2009 New Member

    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>&-
     
  2. falko

    falko Super Moderator Howtoforge Staff

    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.
     
  3. newtolinux2009

    newtolinux2009 New Member

    thanks

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

Share This Page