From 90c21a27bb648a3c592cc7d2ea18a944177c8f83 Mon Sep 17 00:00:00 2001 From: Tom Ryder Date: Sat, 20 Aug 2016 01:26:38 +1200 Subject: Move oldpwd.sh functionality into profile --- sh/profile | 16 +++++++++++----- sh/profile.d/oldpwd.sh | 5 ----- 2 files changed, 11 insertions(+), 10 deletions(-) delete mode 100644 sh/profile.d/oldpwd.sh (limited to 'sh') 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 -- cgit v1.2.3