aboutsummaryrefslogtreecommitdiff
path: root/bin/sh/profile
diff options
context:
space:
mode:
Diffstat (limited to 'bin/sh/profile')
-rw-r--r--bin/sh/profile21
1 files changed, 20 insertions, 1 deletions
diff --git a/bin/sh/profile b/bin/sh/profile
index b77c8787c79d..ee0879a13e0b 100644
--- a/bin/sh/profile
+++ b/bin/sh/profile
@@ -1,4 +1,3 @@
-# $FreeBSD$
#
# System-wide .profile file for sh(1).
#
@@ -12,3 +11,23 @@
# msgs -q
# Allow terminal messages
# mesg y
+
+# Load each .sh file in /etc/profile.d/, then /usr/local/etc/profile,
+# then each .sh file in /usr/local/etc/profile.d/.
+_loaded=${_loaded:-/etc/profile}
+export _loaded
+for _dir in /etc /usr/local/etc ; do
+ for _file in "${_dir}"/profile "${_dir}"/profile.d/*.sh ; do
+ if [ -f "${_file}" ] ; then
+ case :${_loaded}: in
+ *:"${_file}":*)
+ ;;
+ *)
+ _loaded="${_loaded:+${_loaded}:}${_file}"
+ . "${_file}"
+ ;;
+ esac
+ fi
+ done
+done
+unset _loaded _dir _file