sophister / 2bugua5

工作、生活的碎碎念

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

shell 相关

sophister opened this issue · comments

commented

ssh登录远程服务器,通过 ENDSSH这种方式执行一些命令,同时将本地变量传给远端:

CTN=1
ssh -q user@host 'exec bash -s' << ENDSSH
cd abc/def
./scriptname "$CTN"
ENDSSH

参考这篇stackoverflow