(This is not necessarily an answer, but I posted as such due to the amount of code. I have no practical experience with whiptail
. Will delete this later if a whiptail
user posts a tested solution on this.)
As Bash Shell Scripting/Whiptail writes:
From its README: whiptail is designed to be drop-in compatible with
dialog(1), but has less features: some dialog boxes are not
implemented, such as tailbox, timebox, calendarbox, etc.
That means you not necessarily have to decide for one or the other. Just detect which one is available then let the script use it:
# check whether whiptail or dialog is installed
# (choosing the first command found)
read dialog <<< "$(which whiptail dialog 2> /dev/null)"
# exit if none found
[[ "$dialog" ]] || {
echo 'neither whiptail nor dialog found' >&2
exit 1
}
# just use whichever was found
"$dialog" --msgbox "Message displayed with $dialog" 0 0
(Yes, the above detection will fail on tools installed inside directories with name containing newline characters. I just kept it simple.)