+ -
当前位置:首页 → 问答吧 → shell script 问题

shell script 问题

时间:2011-01-23

来源:互联网

我有 temp 目錄底下有 a , b, ,c ,d 四個子目錄

a,b,c,d四個子目錄下都有一支啟動程式  nohup perl test.pl &

那我這樣要弄四次

我想寫一支shell 一起啟動四個子目錄下的程式

請問要怎麼寫?

謝謝

作者: shihyu   发布时间: 2011-01-23

for i in a b c d
do
   cd a
    nohup perl test.pl &
   cd -
done

作者: cjaizss   发布时间: 2011-01-23

回复 shihyu
  1. #!/bin/bash
  2. for i in `find . -name "test.pl"`
  3. do
  4. nohup perl $i &
  5. done
复制代码

作者: yxlhit2010   发布时间: 2011-01-23