commit 3f75be951cf40daaa4228dc06b916b2e25e2320e
parent 94ce86259cdb8e90cd72699534413df421a9f200
Author: Jacob R. Edwards <jacobouno@protonmail.com>
Date: Sat, 21 Nov 2020 21:00:41 -0800
Fix include shell function
If the shell is a login shell, or rather, **argv is a dash (`-'),
basename would think it an option. While fixing this I decided to
globaly define `__progname' as the basename of $0 for use anywhere and
folded the long line to well under a screen width.
Diffstat:
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/modules/aliases/.config/aliases/main b/modules/aliases/.config/aliases/main
@@ -1,9 +1,15 @@
# shell aliases and functions
+__progname=`basename -- $0`
+
# include shell module.
include() {
local include="${ALIASES:?unset}/$1"
- test -f "$include" || { printf "%s: include: \'%s\': File nonexistent.\n" `basename $0` $include; return 1 ;}
+ test -f "$include" || {
+ printf "%s: include: '%s': File nonexistent.\n" \
+ $__progname $include;
+ return 1
+ }
. "$include"
}