Skip to contentSkip to conversation

/etc/profile: read in /etc/profile.d/*.sh files

PATCH New Thomas De Schampheleire 2 participants 3 messages Oct 19, 2011 – Oct 28, 2011

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 /etc/profile: read in /etc/profile.d/*.sh files

For custom projects, it is more maintainable to add custom profile settings in a separate file, than directly in /etc/profile.

This patch modifies /etc/profile to read in *.sh files from /etc/profile.d/, a technique commonly used in Linux distributions.

---
 fs/skeleton/etc/profile |  7 +++++++
 1 files changed, 7 insertions(+), 0 deletions(-)
fs/skeleton/etc/profile +7 -0
@@ -46,3 +46,10 @@ if [ "$PS1" ]; then
     alias calc='calc -Cd '
     alias bc='calc -Cd '
 fi;
+
+# Source configuration files from /etc/profile.d
+for i in /etc/profile.d/*.sh ; do
+    if [ -r "$i" ]; then
+        . $i
+    fi
+done
#1 lore raw

PATCH 1/1 /etc/profile: read in /etc/profile.d/*.sh files

Quoted 22 lines · Thomas De Schampheleire

For custom projects, it is more maintainable to add custom profile settings in a separate file, than directly in /etc/profile.

This patch modifies /etc/profile to read in *.sh files from /etc/profile.d/, a technique commonly used in Linux distributions.

---
?fs/skeleton/etc/profile | ?7 +++++++
?1 files changed, 7 insertions(+), 0 deletions(-)

fs/skeleton/etc/profile +0 -0
@@ -46,3 +46,10 @@ if [ "$PS1" ]; then

? ? alias calc='calc -Cd '
? ? alias bc='calc -Cd '
?fi;

fs/skeleton/etc/profile if [ "$PS1" ]; then · line 55

Quoted 7 lines
fs/skeleton/etc/profile +7 -0
+
+# Source configuration files from /etc/profile.d
+for i in /etc/profile.d/*.sh ; do
+ ? ?if [ -r "$i" ]; then
+ ? ? ? ?. $i
+ ? ?fi
+done

bump

#2 lore raw

PATCH 1/1 /etc/profile: read in /etc/profile.d/*.sh files

In reply to Thomas De Schampheleire
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

"Thomas" == Thomas De Schampheleire <[email protected]> writes:

Thomas> For custom projects, it is more maintainable to add custom Thomas> profile settings in a separate file, than directly in Thomas> /etc/profile.

Committed, thanks.

Signature · 1 line
Bye, Peter Korsgaard