I tried to return the result of a question asked from the dialog
command.
But when I tried that, it freeze and when I press an arrow or enter, it clear the screen, and I just see : numerical argument nessecary
. I think it's an error throw by return
, but I don't no why?
That is not an error from Dialog, because the same command without the return
work.
function BUL_askYesNo()
{
return $(dialog --yesno "$1" 0 0)
}
I tried with KDialog, and it work, so I don't know what is the probleme with Dialog...
When you run dialog
in command substitution $()
, the stdout is not terminal any more.
You need to pass it to dialog
:
#!/usr/bin/env bash
function BUL_askYesNo()
{
exec 3>&1
return $(dialog --yesno "$1" 0 0 2>&1 1>&3)
}
BUL_askYesNo Hello
But return
is still not working. I think this is much simpler :
#!/usr/bin/env bash
function BUL_askYesNo()
{
dialog --yesno "$1" 0 0
}
BUL_askYesNo Hello