0

I'm creating script that runs commands based on information from a checklist dialog:

dialog --checklist "Choose what you want to install:" 0 0 0  1 mysql on 2 java on  3 git off 2> tempfile

dialog box

I have the correct data in tempfile (1 2), but I don't know how to use this data in future in my script.

Zanna
  • 69,223
  • 56
  • 216
  • 327
Valentyn Hruzytskyi
  • 557
  • 2
  • 10
  • 23

1 Answers1

3

You can use --output-fd 1 to send output to stdout and then capture it as normal.

answer=$(dialog --checklist "Choose what you want to install:" 0 0 0  1 mysql on 2 java on  3 git off --output-fd 1)
pLumo
  • 26,204
  • 2
  • 57
  • 87
  • Ok, answer accept data "1 2". How to split and use them in future? – Valentyn Hruzytskyi Oct 19 '18 at 10:53
  • 1
    try [this](https://stackoverflow.com/questions/918886/how-do-i-split-a-string-on-a-delimiter-in-bash) or [this](https://stackoverflow.com/questions/816820/use-space-as-a-delimiter-with-cut-command) or [this](https://askubuntu.com/questions/231995/how-to-separate-fields-with-space-or-tab-in-awk) ... – pLumo Oct 19 '18 at 13:16