bash 在单个程序中管理多个命令

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/26497865/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-18 11:36:55  来源:igfitidea点击:

supervisord multiple commands in single program

bashunixmakefilesupervisord

提问by Verhogen

How do I make a program for supervisord execute a command like

我如何为 supervisord 制作一个程序执行类似的命令

make && run-my-app.sh

It seems to try to pass && run-my-app.shas arguments to make. I've tried different combinations of quotes around things, but I can't seem to get this syntax right.

它似乎试图&& run-my-app.sh作为参数传递给 make。我已经尝试了不同的引号组合,但我似乎无法正确理解这种语法。

回答by Peter Szeto

You can enclose it in quotes to make it evaluate as two separate commands instead of making it appear && run-my-app.sh as arguments to make.

您可以将其括在引号中,使其作为两个单独的命令进行评估,而不是将其显示为 && run-my-app.sh 作为要进行的参数。

command=/bin/bash -c "make && run-my-app.sh"