启动屏幕(unix命令)+在1个命令中运行命令? [英] Starting up a screen (unix command) + running a command in 1 command?
本文介绍了启动屏幕(unix命令)+在1个命令中运行命令?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
想知道如何启动一个命令,例如:
Was wondering how I can start up a command such as:
while :; do ./myCommand; done;
但是不要像平常一样
screen -S nameOfMyScreen
然后输入命令
while :; do ./myCommand; done;
然后分离屏幕
^a ^d (Control "a" the control "d"
我希望它启动并分离。谢谢!
I would like it to start and detach. Thanks!
推荐答案
screen -d -m sh -c "while :; do ./myCommand; done;"
说明:
-
-d -m
以分离模式启动屏幕(创建会话,但不附加该会话) -
sh -c命令行
启动一个执行给定命令行的外壳程序(由于您使用的是while
内置)。
-d -m
starts screen in detached mode (create session but don't attach to it)sh -c commandline
starts a shell which executes the given command line (necessary, since you are using thewhile
builtin).
这篇关于启动屏幕(unix命令)+在1个命令中运行命令?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文