Skip to content

Instantly share code, notes, and snippets.

@rahulinux
Last active September 11, 2016 06:56
Show Gist options
  • Select an option

  • Save rahulinux/6579590 to your computer and use it in GitHub Desktop.

Select an option

Save rahulinux/6579590 to your computer and use it in GitHub Desktop.

Revisions

  1. rahulinux revised this gist Sep 16, 2013. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion YesOrNo.sh
    Original file line number Diff line number Diff line change
    @@ -1,5 +1,5 @@
    YesOrNo() {
    while [[ $x = "" ]]
    while :
    do
    read -p 'Do you want to Continue (yes/no?): ' answer
    case "${answer}" in
  2. rahulinux created this gist Sep 16, 2013.
    18 changes: 18 additions & 0 deletions YesOrNo.sh
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,18 @@
    YesOrNo() {
    while [[ $x = "" ]]
    do
    read -p 'Do you want to Continue (yes/no?): ' answer
    case "${answer}" in
    [yY]|[yY][eE][sS]) exit 0 ;;
    [nN]|[nN][oO]) exit 1 ;;
    esac
    done
    }

    # Usage:

    # if $( YesOrNo ); then
    # echo "Ans is yes.. Do something....."
    # else
    # echo "Ans is No... skip.."
    # fi