【发布时间】:2015-12-19 19:37:21
【问题描述】:
谁能帮我解释一下这个循环是什么?
for file in `ls *SC*`; do
for content in `cat $file `; do
scid=`echo $file|awk -F'.' '{print $1}'`
printf "%-10s%s\n" $scid $content
done
done > text1
【问题讨论】:
-
尝试在superuser.com做这个问题,你可以在每行的开头使用4个空格,使其格式类似于
code,参见help page。 -
你可以试试eplainshell
-
使用
$(…)代替命令周围的反引号;更容易正确,特别是如果你有时间嵌套符号。 -
它似乎试图展示 shell 反模式。
标签: linux bash shell loops unix