标签: bash
a=5 ssh abc@ip << EOF b=7 echo "Remote Host b is $b " EOF echo "Local host b is $b "
将本地变量的值从远程主机获取到localhost
答案 0 :(得分:1)
r=$(ssh abc@ip 'b=7; echo $b') echo "Remote Host b is $r"
或
ssh abc@ip 'b=7; echo "Remote Host b is $b"'