unable to retrive profile variable using ssh
unable to retrive the profile vaiable using ssh.
server2 ==> user apptst ==> bash profile has $APPHOME variable. was trying to retrive the value from server1 using ssh but failed. used below options Quote:
Quote:
any suggestions what is misisng and how can get the variable from server2. Best Regards, KJ. |
I suspect that $APPHOME variable is defined on server1 but not on server2.
Quote:
Quote:
|
What do you get when you run?
Code:
server1> ssh apptst@server2 "echo $APPHOME" Code:
server1> ssh apptst@server2 |
did you try using exec?
|
Quote:
|
First, use single quotes around the command to protect the variable from local substitution.
Second, check the environment section of the ssh man page and the invocation section of the bash man page to be sure of how the remote environment is being set. |
Could use the 'env' command
Invoke env on local server and see what returns. Invoke on remote host and compare the two. The variable in question "should" match on both instances. If it doesn't show on remote invocation (but does on local), that would explain the discrepancy.
This removes any question about single/double quote interpretation. |
Hi,
I apologize for the delayed response. Thanks all for your inputs. @allend, $APPHOME is defined on server2 itself. There is no $APPHOME defined on server1. Tried with single quote but no luck. @shivaa, Quote:
Quote:
Code:
server1> ssh apptst@server2 @p2006.prashant, as per @TB0ne the work is being done using ssh then why we need to check with exec. want to stick with ssh only. @yowi, tired many combinations single, double quotes nothing works. @donls, do you want me to enable env in sshd_config on both the server1 and sever2. the question is its just not working when doing echo. but it works when trying with ls or cd or mkdir. confused. Best Regards, KJ. |
Quote:
Code:
$ env The set command also shows some interesting info, but env is what we want this time. |
There's difference between output of:
Code:
server1~$ ssh apptst@server2 "echo $APPHOME" Code:
server1~$ ssh apptst@server2 Code:
server1~$ ssh apptst@server2 'echo $APPHOME' |
In which file are you declaring APPHOME?
|
All times are GMT -5. The time now is 12:09 AM. |