dbfunctions

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

TXT
41
字号
addon () {    # Function is named and defined in file .dbfunctions	while true	do		echo "Adding information "		echo "Type the full name of employee "		read name		echo "Type address for employee "		read address		echo "Type start date for employee (4/10/88 ) :"		read startdate    		echo $name:$address:$startdate		echo -n "Is this correct? "		read ans		case "$ans"  in		[Yy]*)		          echo "Adding info..."		          echo $name:$address:$startdate>>datafile		     sort -u datafile -o datafile		     echo -n "Do you want to go back to the main menu? "		     read ans		     if [ $ans = Y -o $ans = y ]		     then		          return        # Return to calling program		     else		          continue      # Go to the top of the loop		     fi		     ;;		*)		     echo "Do you want to try again? "		     read answer		case "$answer" in		[Yy]*) continue;;		*) exit;;		esac		     ;;	esacdone}	# End of function definition  

⌨️ 快捷键说明

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