Skip to content

Commit

Permalink
conditionally connect /dev/tty only when environment var TTY=1
Browse files Browse the repository at this point in the history
  • Loading branch information
sabine committed Apr 5, 2023
1 parent 950f614 commit 4a1b6d6
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions shell/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -186,14 +186,22 @@ usage() {
echo "using '--fresh' or '--dev'"
}

# Conditionally connect /dev/tty when
# the environment variable TTY is set to 1
if ${TTY+false}; then
TTY=no
fi
R=
prompt() {
# expects to be called as prompt "Do you want to do this? [Y/n]"
printf "$1"
read R </dev/tty
# expects to be called as prompt "Do you want to do this? [Y/n] "
printf "($TTY) $1"
if [ $TTY = 1 ]; then
read R </dev/tty
else
read R
fi
}


RESTORE=
NOBACKUP=
FRESH=
Expand Down

0 comments on commit 4a1b6d6

Please sign in to comment.