Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Expand
titleProceed? [Y/n]
Code Block
languagebash
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; }
Expand
titleScript Directory
Expand
titleSourced Script Check
Code Block
languagebash
[[ "${BASH_SOURCE[0]}" != "${0}" ]] && SOURCED=1
if [ -z "$SOURCED" ]; then
  pretty_error "This script needs to be sourced, i.e. source './virtualenv.bash', not './virtualenv.bash'"
  exit 1
fi