【更新】shell 中的sleep问题

@Ta 2019-06-01发布,2019-06-01修改 5563点击
tasklist.txt文件里面就只有三行
1
2
3
最新修改:
请问下面两段代码有什么不一样的:
代码一:
#以行读取
oldIFS=$IFS;
IFS=$'\n';
for line in $(cat tasklist.txt )
do
echo $line
nohup mpirun -np 1 ./bin/ASDMPI cff &
sleep 1
done
kill -9 $(pgrep ASDMPI)

以上代码输出
1
nohup: appending output to 'nohup.out'
2
nohup: appending output to 'nohup.out'
3
nohup: appending output to 'nohup.out'




代码二:
cat tasklist.txt | while read line
do
echo $line
nohup mpirun -np 1 ./bin/ASDMPI cff &
sleep 1
done
kill -9 $(pgrep ASDMPI)


以上代码输出
1
nohup: appending output to 'nohup.out'


测试环境为:Ubuntu18.04
回复列表(4|隐藏机器人聊天)
添加新回复
回复需要登录