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.
たとえば、acプログラムからsystem()コマンドを使用してシェルコマンドを呼び出すと、シェルコマンドを完了してからプログラムを続行するか、両方を同時に実行するかを指定します。
この情報を見つけるために利用できるすべてのさまざまな方法は何ですか?
fork()またはexec()をノンブロッキングに使用できますが、system()呼び出しはブロッキングです。これは、C プログラムの実行を再開する前に、シェル コマンドが終了するのを待つことを意味します。
fork()
exec()
system()
すぐに戻りたい場合はsystem、後ろに を付けてコマンドを発行する&と、C プログラムが同時に実行されることに注意してください。
system
&
順次例: system("long_script.sh");
system("long_script.sh");
同時実行例: system("long_script.sh &");
system("long_script.sh &");