objective c - Execute a terminal command from a Cocoa app - Stack Overflowのような感じで。
What is the sh -c command? - Ask Ubuntuの
You can simulate login-shells behavior using the
-l
option:
を参考にして /bin/sh -c
部分を /bin/bash -lc
で実装してやると、 ~/.bash_profile
などが読み込まれた状態をシミュレートできるので $PATH
を通して使っている外部コマンドなどを呼び出しやすくなる。