Detect if the scripts are not sourced and print help.

This commit is contained in:
Doncho N. Gunchev 2024-03-14 15:05:34 +02:00
parent 5b8a75b75c
commit dc0be5c2a1
Signed by: dgunchev
GPG key ID: D30FD19F37E002A9
4 changed files with 20 additions and 0 deletions

View file

@ -1,3 +1,8 @@
if [ "${BASH_SOURCE-}" = "$0" ]; then
echo -e "You must source this script:\n\tsource $0" >&2
exit 33
fi
# show hidden files and directories
alias l.='ls -d .[^.]* ..?* --color=tty 2>/dev/null'

View file

@ -1,3 +1,8 @@
if [ "${BASH_SOURCE-}" = "$0" ]; then
echo -e "You must source this script:\n\tsource $0" >&2
exit 33
fi
EDITOR=mcedit
export EDITOR

View file

@ -42,6 +42,11 @@
# - http://www.onerussian.com/Linux/bash_history.phtml
# - https://debian-administration.org/article/175/BASH_history_forever.
if [ "${BASH_SOURCE-}" = "$0" ]; then
echo -e "You must source this script:\n\tsource $0" >&2
exit 33
fi
if [ "$PS1" ] ; then # interactive shell detection
# Log the logout event.

View file

@ -1,2 +1,7 @@
if [ "${BASH_SOURCE-}" = "$0" ]; then
echo -e "You must source this script:\n\tsource $0" >&2
exit 33
fi
TIME_STYLE=long-iso
export TIME_STYLE