#!/bin/bash
file="/home/vdabas2/file2"
while IFS='' read -r line || [[ -n "$line" ]];
do
pbreplay -O "$line" >> output
done < "$file"我能够逐行读取文件,并且正在使用上面的shell脚本将处理的每一行的输出重定向到输出。
但是,我需要一个不同的文件作为重定向输出,用于处理的每一行,并保存它,如output1、output2等。因此,如果该文件中有10行是作为参数传递的,那么我需要10个输出文件。
发布于 2018-01-17 08:28:26
#!/bin/bash
file="/home/vdabas2/file2"
i=1
while IFS='' read -r line || [[ -n "$line" ]];
do
pbreplay -O "$line" >> output.${i}
((i++))
done < "$file"例如,添加增量。
https://stackoverflow.com/questions/48296581
复制相似问题