I have a problem with one of my shell scripts. The script starts with #!/bin/bash. It is an installation script using whiptail. I really need the 'ESC' key for at least a whiptail box using the "--textbox" box type: it prints a file with only the "OK" button.

My "ergonomic" problem is: I want to have a choice on this box but with only one button, it is impossible.

My solution is: To use the 'ESC' key as a second choice.

But it remains a "software" problem to solve: On Debian / Ubuntu distros, it works well. On CentOS / Fedora distros, 'ESC' is not handled by whiptail, it is ignored. I noticed that the 'ESC' key was a kind of 'TAB' on the command line whereas it is well handled in "vi" for example.

I tried the 'CTRL-[' keys as a replacement of 'ESC' but it works only for Debian and Ubuntu distros.

This is an easy way to reproduce the problem:

whiptail --msgbox "hello" 5 30

If 'ESC' works, you should be able to quit the box. Else, 'ESC' is just ignored and you can only type on 'Enter'.

I think that the problem could come from a bash option, but I do not know where and what to look for.

  • While typing my question, I found a workaround. I replaced: whiptail --title "${title}" --backtitle "type ESC: ${no_label}" --ok-button "${yes_label}" --scrolltext --textbox ${file} ${height} ${width} By this: file_content=$(cat ${file}) and whiptail --title "${title}" --backtitle "type ESC: ${no_label}" --yes-button "${yes_label}" --no-button "${no_label}" --scrolltext --textbox ${file_content} ${height} ${width} A real answer to my problem is still very interesting since it will provide a better behavior to my whole script ('ESC' is often used for going back to a kind of hub). Thx.
    – squalbee
    Sep 2, 2015 at 23:36
  • I checked: all versions of whiptail are the same.
    – squalbee
    Sep 3, 2015 at 0:00


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.