I have 10 script files and each file contain up to 100 commands ( each command take 1 min ). At the moment it saves me time and I click only one file to execute 100 commands but what I want is another script file which execute 10 script files sequentially instead of me waiting for each to finish and then executing the second script file by clicking it.
10247 次
2 に答える
5
以前と同じように各スクリプトを呼び出すだけですが、セミコロンで区切ります ;
各スクリプトの実行が終了すると、bash は次のスクリプトの実行を開始します。
ターミナルで:
./scriptsrc/script_1; ./scriptsrc/script_2; ./scriptsrc/script_n;
さらにガイダンスが必要な場合は、この質問を確認してください。かなり似ています。
編集: 他のスクリプトから複数のスクリプトを実行したい場合は、ファイルが実行可能であることをカーネルに伝えるシバン行を追加してから、必要なスクリプトをリストするだけで実現できます。
#!/bin/bash
./scriptsrc/script_1
./scriptsrc/script_2
./scriptsrc/script_n
echo "script execution complete"
于 2012-07-14T00:42:29.577 に答える