mirror of
https://github.com/notwa/rc
synced 2024-10-31 17:14:36 -07:00
18 lines
391 B
Bash
Executable file
18 lines
391 B
Bash
Executable file
#!/usr/bin/env bash
|
|
if [ -n "${ZSH_VERSION:-}" ]; then
|
|
confirm() {
|
|
read -q '?Continue? [y/N] '
|
|
ret=$?
|
|
echo
|
|
return $ret
|
|
}
|
|
else
|
|
confirm() {
|
|
# specify stdin (1) to avoid taking input from pipes
|
|
read -n1 -u 1 -p "Continue? [y/N] " c
|
|
echo
|
|
[ "$c" != 'y' ] && [ "$c" != 'Y' ] && return 1
|
|
return 0
|
|
}
|
|
fi
|
|
confirm
|