example06.172

来自「UNIX+shell范例精解(第4版)代码」· 172 代码 · 共 32 行

172
32
字号
!#/bin/ksh# This korn shell script will collect data for awk to use in # generating form letter(s). See above.print "Hello $LOGNAME. "print "This report is for the month and year:"cal | nawk 'NR==1{print $0}'if [[ -f data.form  || -f formletter? ]]then 	rm data.form formletter?  2> /dev/nullfiinteger num=1while truedo	print "Form letter #$num:"	read project?"What is the name of the project? "	read sender?"Who is the status report from? "	read recipient?"Who is the status report to? "	read due_date?"What is the completion date scheduled? "	echo $project:$recipient:$sender:$due_date > data.form	print -n "Do you wish to generate another form letter? "	read answer	if [[ "$answer" != [Yy]* ]]	then		break	else		nawk -f form.awk  data.form  > formletter$num	fi	(( num+=1 ))done		nawk -f form.awk data.form > formletter$num

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?