SHARE
TWEET

Untitled

a guest Aug 20th, 2019 76 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #!/bin/sh
  2.  
  3. ask_if_continue () {
  4.     while true; do
  5.         # Prompt
  6.         echo "Continue? (y/N)"
  7.         read yesno
  8.  
  9.         # To lower case.
  10.         yesno=`echo $yesno | tr [A-Z] [a-z]`
  11.  
  12.         # Break on valid only.
  13.         if [ "$yesno" = "y" ]; then
  14.             # It's yes.
  15.             echo "Yes"
  16.             break
  17.         elif [ "$yesno" = "n" ]; then
  18.             # It's no.
  19.             echo "No"
  20.             return
  21.         fi
  22.     done
  23. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top