readline-sync/lib/read.sh
2014-07-12 07:37:25 +09:00

10 lines
202 B
Bash

if [ "$1" = "noechoback" ]; then
stty -F /dev/tty -echo echonl
read LINE </dev/tty
stty -F /dev/tty echo -echonl
# printf '\n' >/dev/tty
else
read LINE </dev/tty
fi
printf '%s' "$LINE"
exit 0