Forum OpenACS Q&A: Re: Use /etc/profile-postgres.sh

Collapse
Posted by Malte Sussdorff on
Amen to that. For the record, SuSE uses /etc/profile.d/ for storing these kind of files and it is fairly usefull (as all files get sourced at system start AFAIK). Who is going to add this to the documentation ?
Collapse
Posted by Andrew Piskorski on
Oh, Red Hat seems to have /etc/profile.d/ as well, I didn't know about that. Debian does not though. Ah, it is used via a little loop at the end of /etc/profile:
for i in /etc/profile.d/*.sh ; do
    if [ -r "$i" ]; then
        . $i
    fi
done
unset i
So that's good, there's no magic going on behind the scenes, it is just good old /etc/profile doing the work. Very simple.

(I guess nobody in the Linux world worries about /bin/sh vs. /bin/bash differences anymore, since most Linux distributions use bash for everything. That "; then" syntax won't work in sh, like you sometimes find on Solaris...)