0
a=5
ssh [email protected] << EOF
b=7
echo "Remote Host b is $b "
EOF
echo "Local host b is $b "
以從遠程主機的局部變量的值到localhost如何採取可變從遠程主機到本地主機在bash
a=5
ssh [email protected] << EOF
b=7
echo "Remote Host b is $b "
EOF
echo "Local host b is $b "
以從遠程主機的局部變量的值到localhost如何採取可變從遠程主機到本地主機在bash
r=$(ssh [email protected] 'b=7; echo $b')
echo "Remote Host b is $r"
或
ssh [email protected] 'b=7; echo "Remote Host b is $b"'