以下命令失败:
ssh -t user@server-01 sudo -iu suser "cd /opt/jboss ; ./portal.sh stop"
我得到:
bash: ./portal.sh: No such file or directory
如何远程更改目录并在该目录中执行远程命令?
答案1
解决方案是:
ssh -t user@server-01 sudo -iu suser "eval 'cd /opt/jboss ; ./portal.sh stop'"