Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 2 Current »



About

Interacting with the user for, e.g. input.

Code Snippets

 Proceed? [Y/n]
function proceed_prompt () {
    read -p "Proceed? [Y/n]" -n 1 -r
    if [[ -z $REPLY ]]; then
       return 0
    elif [[ $REPLY =~ ^[Yy]$ ]]; then
        echo    # move to a new line
        return 0
    else
        echo    # move to a new line
        return 1
    fi
}
proceed_prompt || { echo "Aborting"; return; }

  • No labels