summaryrefslogtreecommitdiff
path: root/etc/functions/confirm_yes
diff options
context:
space:
mode:
Diffstat (limited to 'etc/functions/confirm_yes')
-rw-r--r--etc/functions/confirm_yes9
1 files changed, 9 insertions, 0 deletions
diff --git a/etc/functions/confirm_yes b/etc/functions/confirm_yes
new file mode 100644
index 0000000..7389d1d
--- /dev/null
+++ b/etc/functions/confirm_yes
@@ -0,0 +1,9 @@
+## vim:ft=zsh
+echo -n "$* [Y/n] "
+read -k 1
+[[ $REPLY != $'\n' ]] && echo
+if [[ $REPLY == 'y' || $REPLY == 'Y' || $REPLY == $'\n' ]] {
+ true
+} else {
+ false
+}