0
I want to write a bash function
locally (on MacOS), so when I run this function the first command is to get connected to an ubuntu Remote Desktop through ssh
.
In a nutshell:
my_func () {
ssh blah blah blah;
echo $VARIABLE;
}
The desired output is sth like /home/ubuntu/path/to/directory
, but I get nothing. So I have the impression that my_func
works only locally.
P.S. The environment variable $VARIABLE
is set in the ~/.bashrc
in the remote Desktop.
Where does
$VARIABLE
get set? Also the;
's are unnecessary, bash treats new lines as command separators. Why do you think it would work remotely? – jesse_b – 2017-10-05T22:54:40.080@Jesse_b Edited. – thanasissdr – 2017-10-05T22:58:15.343
So you want it to SSH to the remote machine and then execute the command:
echo $VARIABLE
? – jesse_b – 2017-10-05T22:59:01.663@Jesse_b Exactly (basically, I want to do other things, but this is an important step to achieve the next steps). – thanasissdr – 2017-10-05T22:59:32.890