【发布时间】:2012-06-29 00:06:36
【问题描述】:
我已经编写了一个批处理脚本来使用 Hugin 使用的命令行工具生成全景图。其中几个工具的一个有趣之处是它们允许多核使用,但必须在命令中标记此选项。
到目前为止我的想法:
#get the last fields of each line in the file, initialize the line counter
results=$(more /proc/cpuinfo | awk '{print ($NF)}')
count=0
#loop through the results till the 12th line for cpu core count
for result in $results; do
if [ $count == 12 ]; then
echo "Core Count: $result"
fi
count=$((count+1))
done
有没有更简单的方法来做到这一点?
【问题讨论】:
标签: linux bash text-processing