I do not believe the results from HappyTux and ondoho are GUI.
I've never used dialog, so I experimented a bit and did some web searching, because it's a really weird to use command.
Seems as if you can use the dialog specified, the output result goes to stderr. Which is file handle 2, you can redirect that to somewhere.
The answer there is really weird, to me. I guess it depends how well a person knows I/O redirection, I'm not really good at it.
See the top voted answer in this link,
https://askubuntu.com/questions/4915...ariable#704616
They also explain a great deal how the I/O redirection actions occur.
This example code is along the lines of their recommendation:
Code:
exec 3>&1;
result=$(dialog --checklist "Select needed software" 20 75 5 \
"Evince" "PDF Viewer" on \
"Pinta" "MS-Paint like Software " off \
"htop" "Shows running processes" off \
"vim" "txt editor" off 2>&1 1>&3);
exitcode=$?;
exec 3>&-;
echo $result $exitcode;
The variable "result" will contain strings for each of the selected options. Checking the variable "exitcode" to determine that is is zero will indicate if there was a valid return from the dialog call.
A suggestion is to give those numbers to simplify your compare and then use a switch statement, and you do not need 5 options if you only have 4:
Code:
exec 3>&1;
result=$(dialog --checklist "Select needed software" 20 75 4 \
1 "Evince - PDF Viewer" on \
2 "Pinta - MS-Paint like Software" off \
3 "htop - Shows running processes" off \
4 "vim - txt editor" off 2>&1 1>&3);
exitcode=$?;
exec 3>&-;
echo $result $exitcode;
The variable result, when you select all choices becomes "1 2 3 4", and given bash's string processing capabilities, I'm sure you can treat this as an array or list and process each element in it, as I suggest, using a switch case, like what is shown in HappyTux's post.