diff options
author | Stephen Hemminger <shemminger@vyatta.com> | 2009-02-12 19:54:03 -0800 |
---|---|---|
committer | Stephen Hemminger <stephen.hemminger@vyatta.com> | 2009-02-17 15:46:41 -0800 |
commit | 03fdd12651ac3d6c370e203d32d785253a7bd6c2 (patch) | |
tree | 7910e6ced2f26d8880f4047982feb56749dbcd4f /scripts | |
parent | f9399f6cd3aeff3478d47183932b771aa4f19d5e (diff) | |
download | vyatta-op-03fdd12651ac3d6c370e203d32d785253a7bd6c2.tar.gz vyatta-op-03fdd12651ac3d6c370e203d32d785253a7bd6c2.zip |
Prompt before immediate shutdown
Add yesno helper script and prompt before shutdown
Diffstat (limited to 'scripts')
-rwxr-xr-x | scripts/yesno | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/scripts/yesno b/scripts/yesno new file mode 100755 index 0000000..dd186c7 --- /dev/null +++ b/scripts/yesno @@ -0,0 +1,20 @@ +#! /bin/bash +# Usage: yesno prompt... + +if [ $# -eq 0 ] +then prompt="yes or no: " +else prompt="$*" +fi + +while true +do + read -p "$prompt" || exit 1 + case "$REPLY" in + y*|Y*) exit 0;; + n*|n*) exit 1;; + *) echo "Answer yes or no please";; + esac +done + + + |