Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am going to create script which will use user input, so I decided to use whiptail, but little bit confuse that which one is portable and will work in ubuntu 10.x and higher and CentOs5.x and higher.

I know read, but I want dialog like tool, so if anybody know any alternative just let me know.

share|improve this question
up vote 9 down vote accepted

whiptail is installed by default on most deb-based systems, while dialog is not.

Afair, on rpm-based whiptail is also default dialog app.

I guess it matters for you.

So whiptail is the right choice from point of portability.

Also whiptail is based on newt, while dialog is based on ncurses. From my point of view, the first one is more beautiful (:

share|improve this answer
good to know extra info :) – Rahul Patil Feb 13 '13 at 14:20
The script might be more or less portable, but the dialog program itself is no less portable than whiptail. – Thomas Dickey Oct 29 '15 at 22:45

Why not use both:

(Requires bash 4)

#!/usr/bin/env bash
t(){ type "$1"&>/dev/null;}
function Menu.Show {
   local DIA DIA_ESC; while :; do
      t whiptail && DIA=whiptail && break
      t dialog && DIA=dialog && DIA_ESC=-- && break
      exec date +s"No dialog program found"
   done; declare -A o="$1"; shift
   $DIA --backtitle "${o[backtitle]}" --title "${o[title]}" \
      --menu "${o[text]}" 0 0 0 $DIA_ESC "$@"; }

Menu.Show '([backtitle]="Backtitle"
            [question]="Please choose:")'          \
            "Option A"  "Stuff...."                \
            "Option B"  "Stuff...."                \
            "Option C"  "Stuff...."    
share|improve this answer

(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.)

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.