Chinaunix

标题: 新手请教:想一个shell脚本同时循环执行多次,该怎么处理? [打印本页]

作者: eirp    时间: 2014-07-15 22:00
标题: 新手请教:想一个shell脚本同时循环执行多次,该怎么处理?
如下方法是否可以:
for tmp in $TEMP
do
    ./test.sh $tmp &
done
谢谢!
作者: jason680    时间: 2014-07-15 22:09
回复 1# eirp

可以
   
作者: Shell_HAT    时间: 2014-07-15 22:10
亲自试试就知道啦
作者: eirp    时间: 2014-07-15 22:18
我最开始是

for tmp in $TEMP
do
     .
     .
    echo "command:"
    command &tmp &>>result.txt
     .
     .
done
感觉执行的时候,仍然是串行执行的,这个有什么问题吗?
作者: Shell_HAT    时间: 2014-07-15 22:28
command &tmp &>>result.txt
这一行是想表达什么意思?
作者: 用户名注册后不能更改    时间: 2014-07-16 01:36
回复 5# Shell_HAT

我觉得是$tmp打错……
作者: ly5066113    时间: 2014-07-16 08:38
回复 4# eirp


command $tmp >>result.txt &
作者: seesea2517    时间: 2014-07-16 09:51
回复 6# 用户名注册后不能更改

    @Shell_HAT

他在这里没有打错:http://bbs.csdn.net/topics/390835587

作者: Herowinter    时间: 2014-07-16 09:56
回复 8# seesea2517

CSDN Linux区甚是冷清啊,那贴至今无人回复。
   
作者: seesea2517    时间: 2014-07-16 10:51
回复 9# Herowinter


    不知道为啥冷清了,以前还得。或者板块的问题,其它的板块可能热一点。
作者: 用户名注册后不能更改    时间: 2014-07-16 12:03
回复 8# seesea2517

啊,我以前是混51CTO的,所以没去过CSDN。
作者: seesea2517    时间: 2014-07-16 13:09
回复 11# 用户名注册后不能更改


    我也只是顺便看到了就搬一下链接。不用这么紧张哈哈。




欢迎光临 Chinaunix (http://bbs.chinaunix.net/) Powered by Discuz! X3.2