I have the following script:
#!/bin/bash
set -e
TITLE="Choose version"
VERSIONS=$(cat <<'END'
AAA
BBB
END
)
VERSION_LIST=$(echo "$VERSIONS" | awk '{print NR, " ", $0}')
INDEX=$(whiptail \
--no-cancel \
--menu "$TITLE" 15 40 15 \
$VERSION_LIST \
3>&1 1>&2 2>&3)
When I make it executable and run it, it works as intended. When I call it with source from bash or zsh, one of the following scenarios happens:
- Terminal closes (bash seems to exit)
- Terminal stays open, but will crash/exit soon. Easiest way to reproduce is to type
ls somefileand press TAB for completion.
I'm using Fedora 29 and I also can see this behaviour on Mac OS. Is there any specific consideration that needs to be taken into account when using whiptail/dialog in a sourced script?