whiptail

来自百合仙子's Wiki
跳转到导航 跳转到搜索

Display dialog boxes from shell scripts.

示例

输入文本

#!/bin/bash
#    name: input_name.sh
# created: 02/15/2009

user_name=$HOME/user_name.txt

whiptail --backtitle "A Simple User Interface" \
	 --inputbox "User Name:" 10 20 \
	 2> "$user_name"

if [ $? = 0 ]; then
    echo "The user name is "`cat "$user_name"`
else
    rm -f "$user_name"
    echo "Canceled."
fi

exit 0

参见