I want a ssh session with root
account and env variable JAVA_HOME
. I have export JAVA_HOME
in /etc/bash.bashrc
. When running command,
ssh -t root@localhost "source /etc/bash.bashrc; echo javahome=\$JAVA_HOME"
the printout in the shell is javahome=
. But when doing following, I can see JAVA_HOME
is correctly set.
ssh root@localhost
source /etc/bash.bashrc
echo javahome=$JAVA_HOME
what could be the possible cause? and in generally, how to have a ssh session with JAVA_HOME
set. The scripts are run with bash4
on ubuntu12.04-64
PS: I finally put the configuration script into /root/.profile
, then everything works... which is kinda workaround but not the solution to the problem...