From 8d7221ca2dd5e0b6c633761b314cffed82ddca72 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dag-Erling=20Sm=C3=B8rgrav?= Date: Tue, 18 Oct 2022 15:28:23 +0200 Subject: [PATCH] sh: when loading profile, read only .sh files. Reviewers: jilles, eugen_grosbein.net, cy Subscribers: imp Differential Revision: https://reviews.freebsd.org/D37034 --- bin/sh/profile | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/bin/sh/profile b/bin/sh/profile index ac6acced659..5b8a57d4b7b 100644 --- a/bin/sh/profile +++ b/bin/sh/profile @@ -13,17 +13,12 @@ # Allow terminal messages # mesg y -# Load each file in /etc/profile.d/, then /usr/local/etc/profile, then -# each file in /usr/local/etc/profile.d/. +# 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/* ; do - case ${_file} in - *[~#]|*.OLD|*.bak|*.orig|*,v) - continue - ;; - esac + for _file in "${_dir}"/profile "${_dir}"/profile.d/*.sh ; do if [ -f "${_file}" ] ; then case :${_loaded}: in *:"${_file}":*)