op.sh: check for valid invocation (#33166)

no source
This commit is contained in:
Maxime Desroches 2024-08-01 13:44:57 -07:00 committed by GitHub
parent 7ee9d2d1b9
commit d0671bda6d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 6 additions and 0 deletions

View File

@ -1,5 +1,11 @@
#!/usr/bin/env bash
if [[ ! "${BASH_SOURCE[0]}" = "${0}" ]]; then
echo "Invalid invocation! This script must not be sourced."
echo "Run 'op.sh' directly or check your .bashrc for a valid alias"
return 0
fi
set -e
RED='\033[0;31m'