I use SSH with a heredoc to control remote PC:
val=0
ssh -p 1046 name@10.122.78.99 > result.txt 2>&1 << 'eeooff'
echo $PATH
echo "start"
export vv=333
echo $vv
echo "end"
val=10
eeooff
echo $val
When I check result.txt
, I found echo $PATH
works, but echo $vv
gives nothing. Why? Is setting a variable forbidden when using SSH with a heredoc?
And $val
is still 0
. How to modify to 10 when using SSH with a heredoc?