请问关于shell: while read line里的line 是从哪里来的

kain72 2009-01-04 04:35:10
while read line
do

# skip blank lines
if [ "${line}" = "" ]; then
continue
fi

# get action - 1st word in command
action=`echo "${line}" | cut -d" " -f1`

# Execute the command
db2 -tv "${line}"
rc=$?

if [ ${rc} -eq 0 ]; then
if [ "${action}" = "import" ]; then
if [ "${flg_del_ixf_on_import_success}" = "Y" ]; then
# get ixf filename - 3rd word in command
ixf_file=`echo "${line}" | cut -d" " -f3`
echo "rm ${ixf_file}"
rm ${ixf_file}
fi
fi
continue
fi

#=======================================
# if we get here, had non-zero ret code
#=======================================

# if command is "drop xxx", probably being done to prepare for
# a later "create xxx" command, so we'll ignore error.
if [ "${action}" = "drop" ]; then
word2=`echo "${line}" | cut -d" " -f2`
echo "Ignoring drop ${word2} error"
continue
fi

# Return immediately if rc is higher than allowed.
# Otherwise, ensure retVal is highest rc seen so far,
# so we can return highest return code when done.
if [ ${rc} -gt ${rc_max_continue} ]; then
return ${rc}
else
if [ ${rc} -gt ${retVal} ]; then
retVal=${rc}
fi
fi

done < ${filename}


程序很长,不过问题在第1行
请问第1行while语句的line 是从哪里来的呢?
整个函数都没有对Line的描述或者定义。
麻烦高手帮忙。

...全文
3991 3 打赏 收藏 转发到动态 举报
写回复
用AI写文章
3 条回复
切换为时间正序
请发表友善的回复…
发表回复
jujucom 2010-11-09
  • 打赏
  • 举报
回复
done < ${filename}

是从这个里面读的
blueskysee 2010-05-31
  • 打赏
  • 举报
回复
[Quote=引用楼主 kain72 的回复:]
while read line
do

# skip blank lines
if [ "${line}" = "" ]; then
continue
fi

# get action - 1st word in command
action=`echo "${line}" | cut -d" " -f1`

# Execute the com……
[/Quote]


怎么解决的? 说说
kain72 2009-01-04
  • 打赏
  • 举报
回复
解决咯~

23,125

社区成员

发帖
与我相关
我的任务
社区描述
Linux/Unix社区 应用程序开发区
社区管理员
  • 应用程序开发区社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧