I am making a simple installer that uses whiptail prompts for user input. I'd like to be able to set the default text. Unfortunately --default-item doesn't work and appears to only be for menu items.
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
I have tried using echo "default" | whiptail... but it doesn't seem to do anything.
So my issue was that I am reusing the variable which I am defining. This works thanks to 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