Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我正在尝试编写一个 bash 脚本来自动在网络中的客户端计算机中执行操作。但是在代码之后
ssh -i ~/.ssh/key root@machine
bash 程序刚刚停止 我可以做些什么来将命令发送到远程机器?谢谢
就像您直接调用 bash 一样。
ssh ... somescriptontheserver.sh ssh ... ls -lR / ssh ... << EOF ls -lR / EOF
在 bash 中,标准 (1) 和错误 (2) 输出可以通过以下方式重新路由和丢弃:
>/dev/null 2>&1
但是下面的例子做了一些不同的事情:
nohup myscript.sh >myscript.log 2>&1 </dev/null &
<