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

Re: Output from date command defaults to 12-hour in Buster.



Greg Wooledge (12020-04-29):
> The choice of .bashrc may be fine for GNOME users (hell, it may even be
> *mandatory* for GNOME users, because GNOME is user-unfriendly shit),
> but even then, it only affects commands that are launched from an
> interactive shell.
> 
> In order to take effect in commands that are launched by the window
> manager, or whatever, environment changes should be done much earlier
> in the session.
> 
> For shell logins, you would want to put the command(s) in ~/.profile or
> whatever your login shell's equivalent dot file is.
> 
> For GUI logins that are not GNOME, you can try setting up the environment
> in ~/.xsessionrc -- but note that your Desktop Environment (even if it's
> not GNOME) may overwrite whatever you try to set.

With a smarter shell than bash, there is a solution that works for all
these cases, and even a few others: ~/.zshenv will be called for all zsh
instances (and therefore needs to be very minimalistic, and preferably
set up to avoid overwriting explicit changes).

So it will take effect for login shell on a VC, remote login shell,
remote non-login shell (to set $PATH so that rsync finds
~/local/bin/rsync), programs launched by the WM if it uses $SHELL, even
GUI sessions if ~/.xsessionrc is #!/bin/zsh.

Mine starts with:

[[ "$ZSHENV_USER" == $UID-1 ]] && return
export ZSHENV_USER=$UID-1

And then it sets the environment up. Bonus point: if I change the 1 into
2, it even takes effect on all new shells, no need to re-log.

Regards,

-- 
  Nicolas George

Attachment: signature.asc
Description: PGP signature


Reply to: