This commit is contained in:
Your Name 2024-07-25 18:00:33 -04:00
parent ca8249e079
commit 3cda18fef6
1 changed files with 3 additions and 12 deletions

View File

@ -1,18 +1,9 @@
# /etc/profile.d/sum.sh
# Ensure the script is sourced, not executed
if [ -n "$ZSH_VERSION" ]; then
# For zsh
if [[ "${(%):-%x}" == "$0" ]]; then
echo "This script should be sourced, not executed."
return 1
fi
else
# For bash
if [[ "${BASH_SOURCE[0]}" == "${0}" ]]; then
echo "This script should be sourced, not executed."
return 1
fi
if [[ "$0" == "${BASH_SOURCE[0]}" ]] || [[ "$0" == "${(%):-%x}" ]]; then
echo "This script should be sourced, not executed."
return 1 2>/dev/null || exit 1
fi
# Function to generate SHA-256 hashes for .sh files in a given directory