exec 外部プログラムを実行する &reftitle.description; stringexec stringcommand arrayoutput intreturn_var exec は指定されたコマンド command を実行します。 &reftitle.parameters; command 実行するコマンド output 引数 output が存在する場合、指定した配列は、 コマンドからの出力の各行で埋められます。 \n のような後に続く空白は、この配列には含まれません。 配列に既に何らかの要素が 含まれる場合は、exec は配列の最後に追加される ことに注意してください。関数が要素を追加することを望まないのなら、 それが exec に渡される前に、配列の unset を呼び出してください。 return_var 引数return_varが、引数 output と共に存在する場合、実行したコマンドの ステータスがこの変数に書かれます。 &reftitle.returnvalues; コマンド結果の最後の行を返します。コマンドを実行し、 一切干渉を受けずに直接コマンドから全てのデータを受けとる必要が あるならば、PassThru 関数を使ってください。 実行されたコマンドの出力を取得するには、必ず output パラメータを設定・使用してください。 &reftitle.examples; <function>exec</function> の例 ]]> &reftitle.notes; &warn.escapeshell; ¬e.exec-bg; ¬e.exec-path; &warn.sm.exec; &reftitle.seealso; system passthru escapeshellcmd pcntl_exec バックティック演算子