aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--sh/profile16
-rw-r--r--sh/profile.d/oldpwd.sh5
2 files changed, 11 insertions, 10 deletions
diff --git a/sh/profile b/sh/profile
index 7266d64e..b2889295 100644
--- a/sh/profile
+++ b/sh/profile
@@ -3,11 +3,11 @@ if [ -d "$HOME"/.local/bin ] ; then
PATH=$HOME/.local/bin:$PATH
fi
-# Load all supplementary scripts in ~/.profile.d
-for sh in "$HOME"/.profile.d/*.sh ; do
- [ -e "$sh" ] && . "$sh"
-done
-unset -v sh
+# If we can read ~/.oldpwd, make its contents our OLDPWD
+if [ -r "$HOME"/.oldpwd ] ; then
+ IFS= read -r OLDPWD < "$HOME"/.oldpwd
+ export OLDPWD
+fi
# Trap on exit to run ~/.logout if it exists
logout_trap() {
@@ -25,6 +25,12 @@ for sig in EXIT HUP INT TERM ; do
done
unset -v sig
+# Load all supplementary scripts in ~/.profile.d
+for sh in "$HOME"/.profile.d/*.sh ; do
+ [ -e "$sh" ] && . "$sh"
+done
+unset -v sh
+
# If ENV is unset after running those scripts and ~/.shrc exists, set it as ENV
if [ -z "$ENV" ] && [ -f "$HOME"/.shrc ] ; then
ENV=$HOME/.shrc
diff --git a/sh/profile.d/oldpwd.sh b/sh/profile.d/oldpwd.sh
deleted file mode 100644
index 91dd1dba..00000000
--- a/sh/profile.d/oldpwd.sh
+++ /dev/null
@@ -1,5 +0,0 @@
-# If we can read ~/.oldpwd, make its contents our OLDPWD
-if [ -r "${OLDPWD_FILE:-$HOME/.oldpwd}" ] ; then
- IFS= read -r OLDPWD < "${OLDPWD_FILE:-$HOME/.oldpwd}"
- export OLDPWD
-fi