sh: read more profile files.

Differential Revision: https://reviews.freebsd.org/D36505
MFC after:	1 month

(cherry picked from commit 497cdf9673)

sh: when loading profile, skip obvious scratch files.

Differential Revision: https://reviews.freebsd.org/D36856

(cherry picked from commit d3890a547d)

sh: when loading profile, read only .sh files.

Reviewers: jilles, eugen_grosbein.net, cy

Subscribers: imp

Differential Revision: https://reviews.freebsd.org/D37034

(cherry picked from commit 8d7221ca2d)
This commit is contained in:
Dag-Erling Smørgrav 2022-09-09 13:08:43 +00:00
parent 4a7fe8305e
commit 540add272d
2 changed files with 22 additions and 0 deletions

View file

@ -12,3 +12,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

View file

@ -84,6 +84,8 @@
..
ppp
..
profile.d
..
rc.conf.d
..
rc.d