How to modify environment variables before executing a command

Jim Rees rees at merit.edu
Thu Dec 3 08:42:05 EST 2009


Malte Forkel wrote:

  But I'm still somewhat reluctant to put ssh-specific
  code into .bashrc which does not seem to be meant for non-interactive
  shells while I don't unterstand why the ssh-specific configuration files
  can't export variables.

Ssh has no problem exporting env vars, as you have discovered.  Just put
them in .ssh/environment.  You are trying to do something bash-specific in
your ssh config file:

VAR1=$(date)

That's not going to work.  If you want to run bash code, you have to put it
in a bash config file, not in an ssh config file.


More information about the openssh-unix-dev mailing list