[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Systemd user environment variables not picked up for me



On Mon, Jun 29, 2020 at 10:37:49PM +0300, Andrei POPESCU wrote:
> So far I've settled to the snippet below in *both* ~/.profile and 
> ~/.xsessionrc (inspired by a similar snippet in /etc/profile):
> 
> 
> if [ -d "$HOME"/.config/environment.d ]; then
>   for i in "$HOME"/.config/environment.d/*.sh; do
>     if [ -r "$i" ]; then
>       set -a
>       . "$i"
>       set +a
>     fi
>   done
> fi
> 
> 
> (improvements welcome)

You can drop the [ -d ] check.  If the directory doesn't exist, the glob
won't expand, and then the [ -r ] check will fail, so nothing will happen.


Reply to: