I have Ubuntu 12.04 Server at virtual machine and installed OpenSSH server on it. I have simple script with whiptail
#!/bin/sh
whiptail --title "Example dialog" --infobox "TTTTTT" 8 78
On server this script is working and i seen the infobox. But in SSH session i have no output.
user@ubuntu:~$ ./script
user@ubuntu:~$ ./script
user@ubuntu:~$
Bash script using dialog doesn't working on server.
How i can create visual menu script working in SSH session?
whiptail seems to be buggy displaying infoboxes on certain terminals (see How to display infobox in whiptail?). Maybe you can try a --msgbox instead to verify your script works
whiptail --title "I am the title" --msgbox "Hi there" 8 45
Running whiptail --infobox
in xterm can do this, which results in no visible display:
- suppose that xterm's terminal description includes the alternate-screen switching (which most do, since that is the way xterm and ncurses define it):
smcup=\E[?1049h, rmcup=\E[?1049l,
- alternate-screen switching is enabled.
- conventional terminal applications send
smcup
at the beginning - whiptail is conventional...
- it displays the
--infobox
in the alternate screen - there's nothing more to do (no buttons to click), so whiptail exits
- on the way out, it sends
rmcup
, switching back to the normal screen - the output from the
--infobox
is lost
This matches the behavior reported in OP's question. The Red Hat report mentioned in How to display infobox in whiptail? is describing the same problem, as well as the one in Ubuntu.
The problem was first addressed in dialog in 2003 (though there have been occasional maintenance fixes since then).
The solution used in the other questions was to use dialog (the actual program, rather than the generic "dialog" mentioned in OP's question).
来源:https://stackoverflow.com/questions/21042525/whiptail-or-dialog-dont-working-by-ssh