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.
我正在尝试创建一个 shell 脚本,以便它在 2 个单独的目录中调用两个命令,然后显示它们的反馈,调用 a 命令我猜它会是这样的 ./directory/ ./script.sh
提前感谢您的回复。
如果要按顺序调用命令:
/path/to/command1; /path/to/command2
如果您只想在第一个命令成功时调用第二个命令:
/path/to/command1 && /path/to/command2
如果要并行运行它们:
/path/to/command1 & /path/to/command2
命令的输出将是标准输出(很可能是终端)。如果您并行运行这两个命令并产生一些输出,您可能希望将其重定向到不同的文件。