如何为bash whiptail输入框设置默认文本?

时间:2015-12-21 19:27:51

标签: bash whiptail

我正在制作一个简单的安装程序,它使用whiptail提示进行用户输入。我希望能够设置默认文本。不幸的是 - 默认项目不起作用,似乎只适用于菜单项。

MYLARUSER=$(whiptail --inputbox "Enter the user to run Mylar as (usually pi)" 8 78 $MYLARUSER --title "$SECTION" 3>&1 1>&2 2>&3)
exitstatus=$?; if [ $exitstatus = 1 ]; then exit 1; fi

我尝试过使用echo"默认" |鞭尾......但它似乎没有做任何事情。

1 个答案:

答案 0 :(得分:0)

所以我的问题是我正在重用我定义的变量。这要归功于this reddit user

MYLARUSER=$(whiptail --inputbox "Enter the user to run Mylar as (usually pi)" 8 78 "defaulttext" --title "$SECTION" 3>&1 1>&2 2>&3)
exitstatus=$?; if [ $exitstatus = 1 ]; then exit 1; fi