※ 引述《Maxsolar.bbs@OfO.twbbs.org (Astro v.s. Geo)》之銘言:
> ※ 引述《allen0305.bbs@ptt.cc (Allen)》之銘言:
> : 想請問一下各位
> : 我寫了兩個bat檔如下
> : a.bat
> : ./run_program1
> : ./run_program2
> : b.bat
> : ./a.bat > output.txt &
> : 然後我執行b.bat
> : 原本預期是program_1和program_2會循序執行完
> : 但是我看了output.txt
> : 他執行完program_1就結束了
> : 想請問一下要怎樣才會兩個都執行呢?
> : 謝謝
> 應該是你在執行program1的時候有問題吧,
> 我自己做的測試都ok
> --a.sh--
> #!/bin/bash
> echo abc
> echo def
> exit 0
> -----------
> --b.sh---
> #!/bin/bash
> sh a.sh > out.txt
> exit 0
> ----------
> 成功得到out.txt裡的兩行輸出呢!
> 建議是script裡的command都寫完整路徑吧。
會不會是 shell script 裡面設定了 set -e 造成的?
--
※ Origin: SayYA 資訊站 <bbs.sayya.org>
◆ From: 59-104-129-87.adsl.dynamic.seed.net.tw