Answers for "how to ask y/n question in bash"

0

how to ask y/n question in bash

#!/bin/bash
 
read -r -p "Are You Sure? [Y/n] " input
 
case $input in
    [yY][eE][sS]|[yY])
 echo "Yes"
 ;;
    [nN][oO]|[nN])
 echo "No"
       ;;
    *)
 echo "Invalid input..."
 exit 1
 ;;
esac
Posted by: Guest on April-24-2021

Code answers related to "how to ask y/n question in bash"

Browse Popular Code Answers by Language