I try to set env variables of my own for every users.
Every users log in graphical env : KDE dektop.
I have create a file : /etc/profile.local and put in it :
if "$PROFILE_LOCAL_READ" != "true" ]] ; then
# For all users
export PATH=/backup_sys/000_COMMON/Bin:$PATH
/backup_sys/000_COMMON/Bin/system_wide_common_env_set
fi
#
# set only once
#
if -z "$PROFILE_LOCAL_READ" ]] ; then
readonly PROFILE_LOCAL_READ=true
export PROFILE_LOCAL_READ
fi
The script “/backup_sys/000_COMMON/Bin/system_wide_common_env_set”
source two other scripts
Without specific data,
I wouldn’t know why you may be experiencing problems but
2 things jump out at me… which may or may not be relevant…
The file /etc/profile and /etc/profile.local are read on boot.
For that reason, there are relatively few if any differences how the settings might vary.
So, are you sure you should be writing conditional statements? If the statement is true every time for example, then IMO you should just set the environment variable and not test conditionally whether to do so.
This more a matter of form, but you seem to like placing scripts in binary (bin) folders. I generally only place compiled binaries in bin folders and locate scripts elsewhere. It’s just keeping things categorized consistently, a small thing with benefits down the road.
While troubleshooting and creating your scripts, since your lines of code are so few you might combine them into a single script at least temporarily instead of their current modular form to be certain they all execute properly, and then instrument critical steps (you describe using a command logger of some type), you can also insert additional feedback writing to a file or if a console can be opened you can echo to stdout.