[英]How do I run a terminal command at the same time as executing a C program from terminal
我有一個C程序可執行文件。 我將在運行程序的同時運行終端命令,並且想知道我該怎么做?
./program | ps -l -u ${USER} | grep info
我輸入了USER的用戶名,但得到了:
用法:ps [選項]
嘗試使用“ ps --help”或“ ps --help”以獲取其他幫助文本。
有關更多詳細信息,請參見ps(1)。
不知道我做錯了什么?
如標題中所述回答您要運行的問題
./program & ps ...
您可能要在grep
ps
的輸出時在后台運行./program
:
./program & ps -l -u ${USER} | grep info
&
將./program
放在后台,其中|
用於將一個命令的輸出傳遞給另一個命令
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.