How to modify environment variables before executing a command
    Douglas E. Engert 
    deengert at anl.gov
       
    Thu Dec  3 07:26:17 EST 2009
    
    
  
Malte Forkel wrote:
> 
> Any more suggestions on how to modify environment variables before
> executing a command via ssh?
> 
SSH will set the SSH_CLIENT, SSH_TTY and SSH_CONNECTION
So you can tell if this is an ssh session.
~./.bashrc is always run, and $- on my Ubuntu is hBc
the first time. If its interactive, ~/.bash_profile is then run and
$- is himBH.
Some systems might run /etc/profile as well, so tests are needed
try echo $-
So your .bashrc could test for SSH_CLIENT,and $- for c
and set what it wants. It could also set MY_ENV_HAS_BEEN_SET=1
so you only run you code once at the start of a session.
> Thanks, Malte
> 
> 
> 
> 
> _______________________________________________
> openssh-unix-dev mailing list
> openssh-unix-dev at mindrot.org
> https://lists.mindrot.org/mailman/listinfo/openssh-unix-dev
> 
> 
-- 
  Douglas E. Engert  <DEEngert at anl.gov>
  Argonne National Laboratory
  9700 South Cass Avenue
  Argonne, Illinois  60439
  (630) 252-5444
    
    
More information about the openssh-unix-dev
mailing list