【发布时间】:2020-04-19 14:08:42
【问题描述】:
我想创建一个 bash 脚本,它显示从 mysql 返回的所有数据。 问题是,我需要插入多个命令,例如"mysql -u root" => "使用测试" => "SELECT * FROM test"
我已经通过创建 2 个文件对其进行了测试。只能创建第一个文件。以下是我测试过的版本。有人知道如何在行后输入所有命令吗? 感谢您的关注。
试试 1
sshpass -p "" ssh -o StrictHostKeyChecking=no root@xxx.xxx.xxx.xxx touch test/test1.txt & touch test2.txt
试试2
sshpass -p "" ssh -o StrictHostKeyChecking=no root@xxx.xxx.xxx.xxx touch test/test1.txt && touch test2.txt
试试3
sshpass -p "" ssh -o StrictHostKeyChecking=no root@xxx.xxx.xxx.xxx touch test/test1.txt; touch test2.txt;
试试4
sshpass -p "" ssh -o StrictHostKeyChecking=no root@xxx.xxx.xxx.xxx touch test/test1.txt || touch test2.txt
【问题讨论】: