简体   繁体   English

来自其他主管的基本Shell脚本调用命令并提供反馈

[英]Basic Shell Script call command from another director with feedback

i'm trying to create a shell script so that it calls two commands in 2 seperate directories and then shows their feedback, To call the a command i'm guessing it would be something like this ./directory/ ./script.sh 我正在尝试创建一个shell脚本,以便它在2个单独的目录中调用两个命令,然后显示它们的反馈,要调用该命令,我猜它应该是这样的./directory/ ./script.sh

Thanks in advance for your replies. 提前感谢您的回复。

If you want to sequentially invoke the commands: 如果要顺序调用命令:

/path/to/command1; /path/to/command2

If you want to call the second command only if the first one succeeded: 如果仅在第一个命令成功的情况下才想调用第二个命令:

/path/to/command1 && /path/to/command2

If you want to run them in parallel: 如果要并行运行它们:

/path/to/command1 &
/path/to/command2

The output of the commands will be the standard output (most likely the terminal). 命令的输出将是标准输出(最有可能是终端)。 If you run the two commands in parallel and they produce some output, you might want to redirect it to different files. 如果并行运行这两个命令,它们会产生一些输出,则可能需要将其重定向到其他文件。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM