echo "$title: $author: $category: $new_status: $new_bname: $new_date>>ULIB_FILEelse
应该是:
echo "$title: $author: $category: $new_status: $new_bname: $new_date" >>ULIB_FILEelse
tput cup 12 4echo "Add Another? (y)es or (q)quit: "当你输入 y 或 q 的时候,然后就执行下而的语句:
tput cup 4 18read phonenum 这句就将你输入的 y 或 q 赋给变量phonenum
接下来的就是判断你输的是什么,要是 q 话就退出,这里的退出不是退出while循环,只是退出tput cup 12 4echo "Add Another? (y)es or (q)quit: " 这一步,即不再输其它的.如果要退出while循环的话要加break ,如果说是 y 的话,它仅仅是给phonenum 赋了个变量,什么也没有做,我看后面的也没有再提到phonenum这个变量,我想一定还有其它的代码吧!
然后就接着执行下面的
tput cup 5 18read lname
tput cup 6 18read fname
tput cup 7 18read midinit
tput cup 8 18read deptno
tput cup 9 18read jobtitle
tput cup 10 18read datehired
#Check to see if last name is not a blank before you write to disk
if [ "$lname" >" " ]
then
echo "$phonenum:$lname:$fname:$midinit:$deptno:$jobtitle:$datehired" >>$phonefile
fi
还有下面的一段代码:
tput cup 12 33read looptest
if [ "$looptest" = "q" ]
then
clearexit
fi
就你发表的这一些程序来看,这里根本不起作用,因为在while之前你就已定义了
looptest=y 所以你在这再加上这一句是没有用的,因为looptest就等于y 永远不等于q
然后当你的while没有退出来的时候,它就会不停的循环下去,因为
ooptest=y
while [ $looptest = y ]
do
这一句其实就等于 while : 永远为真,不停的循环下去!
以上为鄙人愚见,鄙人也是名shell初学者,有错误之处还请指出,谅解!谢谢!
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)