aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Makefile1
-rw-r--r--README.markdown5
-rw-r--r--sh/profile6
-rw-r--r--sh/shinit4
-rw-r--r--sh/shrc6
5 files changed, 11 insertions, 11 deletions
diff --git a/Makefile b/Makefile
index cd884662..1131af09 100644
--- a/Makefile
+++ b/Makefile
@@ -307,6 +307,7 @@ install-sh : check-sh
"$(HOME)"/.shrc.d
install -pm 0644 -- sh/profile "$(HOME)"/.profile
install -pm 0644 -- sh/profile.d/* "$(HOME)"/.profile.d
+ install -pm 0644 -- sh/shinit "$(HOME)"/.shinit
install -pm 0644 -- sh/shrc "$(HOME)"/.shrc
install -pm 0644 -- sh/shrc.d/* "$(HOME)"/.shrc.d
diff --git a/README.markdown b/README.markdown
index 22f02d42..fc248800 100644
--- a/README.markdown
+++ b/README.markdown
@@ -97,8 +97,9 @@ they should work in most `sh(1)` implementations. Individual scripts called by
management. Most of these boil down to exporting variables appropriate to the
system and the software it has available.
-Configuration that should be sourced for all POSIX-fearing shells is kept in
-`~/.shrc`, with subscripts read from `~/.shrc.d`.
+Configuration that should be sourced for all POSIX-fearing interactive shells
+is kept in `~/.shrc`, with subscripts read from `~/.shrc.d`. There's a shim in
+`~/.shinit` to act as `ENV`.
I make an effort to target POSIX for my functions and scripts where I can, but
Bash is my interactive shell of choice. My `.bash_profile` calls `.profile`,
diff --git a/sh/profile b/sh/profile
index afc308ea..fd87b8fa 100644
--- a/sh/profile
+++ b/sh/profile
@@ -7,8 +7,8 @@ for sh in "$HOME"/.profile.d/*.sh ; do
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
+# If ENV is still unset, and ~/.shinit exists, use that
+if [ -z "$ENV" ] && [ -f "$HOME"/.shinit ] ; then
+ ENV=$HOME/.shinit
export ENV
fi
diff --git a/sh/shinit b/sh/shinit
new file mode 100644
index 00000000..fe770a70
--- /dev/null
+++ b/sh/shinit
@@ -0,0 +1,4 @@
+# If the shell is interactive, source ~/.shrc
+case $- in *i*)
+ [ -f "$HOME"/.shrc ] && . "$HOME"/.shrc ;;
+esac
diff --git a/sh/shrc b/sh/shrc
index 3e03313c..0e1382aa 100644
--- a/sh/shrc
+++ b/sh/shrc
@@ -1,9 +1,3 @@
-# Make sure the shell is interactive
-case $- in
- *i*) ;;
- *) return ;;
-esac
-
# Don't let anyone write(1) to my terminal
command -p mesg n