Home > Software design >  (Bash) How do I display a command output in a whiptail textbox?
(Bash) How do I display a command output in a whiptail textbox?

Time:09-15

The whiptail command has a --textbox option

A text box lets you display the contents of a text file in a dialog box

I would like to use the output of a command in its place (yup, that's the same question posted here), but the difference is that when I run the command in the response (not the same) whiptail --textbox /dev/stdin 30 60 <<< "$(echo Hello)" I get an empty textbox as you can see here.

Which other ways could you handle the output of a command as a file?

Thank you!

CodePudding user response:

It turns out that cmd | whiptail --textbox /dev/stdin 30 60 doesn't work for you because you're using Bash v5.1, not because of any changes in whiptail.

You can still use this alternative workaround:

whiptail --scrolltext --msgbox "$(cmd)" 30 60

provided the output of cmd is not too big to include in the command line (around 128kb).

I rewrote the original question which you cited, taking into account the change in Bash v5.1 and a more accurate analysis of the original problem, so I'm not going to repeat all of that here.

  • Related