commit 57f8b88eaf2e17aa3f3720056bf569b12333b759
parent 489d9ce17f8aefc7afc5175359fdf6756c33939a
Author: Jacob R. Edwards <n/a>
Date: Tue, 15 Mar 2022 11:45:23 -0700
Split ksh profile into login and interactive rc files
The profile is meant to be run only once. The kshrc is run by every
ksh(1). Since some operations should only be done once (for example,
starting a daemon) and since ksh doesn't save functions in the
environment, this is necessary.
Diffstat:
2 files changed, 40 insertions(+), 32 deletions(-)
diff --git a/local/ksh/.profile b/local/ksh/.profile
@@ -1,8 +1,6 @@
# ksh profile
-set -Xa -o vi
-unalias -a
-biff y
+set -a
IFS='
'
@@ -29,24 +27,6 @@ case "$TERM" in
EDITOR=vi ;;
esac
-g() git "$@"
-r() fc -s "$@"
-h() { fc -ln | fgrep -e "${1:-}"; }
-f() "$EDITOR" "$@"
-
-# Operating System Specific
-case "$(uname)" in
-(OpenBSD)
- PATH="$PATH":/usr/games
- pa() doas pkg_add -x "$@"
- pd() doas pkg_delete -x "$@"
- pf() pkg_locate "$@"
- pi() pkg_info -q "$@"
- pl() pkg_list "$@"
- pr() pkg_root "$@"
- pt() pkg_tree "$@"
-esac
-
# Plan9port Specific
if test -d /usr/local/plan9
then
@@ -57,19 +37,15 @@ then
# More attractive, but not uniform with unicode
#font="$PLAN9"/font/misc/unicode.6x13.font
- ls() 9 ls "$@"
- rm() 9 rm "$@"
-
# Startup "filesystems"
plumber
-else
- lc() command ls -A "$@"
- ls() command ls -1A "$@"
- rm() command rm -d "$@"
fi
-# Try and start aps
-aps && {
- apc stop
- shf < "$HOME"/music/playlists/general | apc add ^
+{
+ aps && {
+ apc stop
+ shf < "$HOME"/music/playlists/general | apc add ^
+ }
} 2>/dev/null
+
+ENV="$XDG_CONFIG_HOME/kshrc"
diff --git a/local/ksh/config/kshrc b/local/ksh/config/kshrc
@@ -0,0 +1,32 @@
+# ksh rc file
+
+set -Xa -o vi
+unalias -a
+
+g() git "$@"
+r() fc -s "$@"
+h() { fc -ln | fgrep -e "${1:-}"; }
+f() "$EDITOR" "$@"
+
+# Operating System Specific
+case "$(uname)" in
+(OpenBSD)
+ PATH="$PATH":/usr/games
+ pa() doas pkg_add -x "$@"
+ pd() doas pkg_delete -x "$@"
+ pf() pkg_locate "$@"
+ pi() pkg_info -q "$@"
+ pl() pkg_list "$@"
+ pr() pkg_root "$@"
+ pt() pkg_tree "$@"
+esac
+
+if test "$PLAN9"
+then
+ ls() 9 ls "$@"
+ rm() 9 rm "$@"
+else
+ lc() command ls -A "$@"
+ ls() command ls -1A "$@"
+ rm() command rm -d "$@"
+fi