⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 example02.07

📁 UNIX[1].shell范例精解(第4版)_code
💻 07
字号:
#!/bin/bash # Gnu bash versions 2.x# The Party Program--Invitations to friends from the # "guest" file #guestfile=~/shell/guestsguestfile=./guestsif [[ ! -e "$guestfile" ]] then	printf "${guestfile##*/} non-existent"	exit 1fiexport PLACE="Sarotini's"(( Time=$(date +%H) + 1 ))declare -a foods=(cheese crackers shrimp drinks '"hot dogs"'                  sandwiches)     declare -i  n=0for person in $(cat $guestfile) do	if  [[ $person == root ]]	then		continue	else 		# Start of here document		mail -v -s "Party" $person <<- FINIS 		Hi $person! Please join me at $PLACE for a party! 		Meet me at $Time o'clock.		I'll bring the ice cream. Would you please bring		${foods[$n]} and anything else you would like to eat?		Let me know if you can make it.		       Hope to see you soon.                          Your pal,                          ellie@$(hostname)		FINIS		n=n+1  		if (( ${#foods[*]} ==  $n )) 		then		   declare -a foods=(cheese crackers shrimp drinks		                     `"hot dogs"` sandwiches)            n=0		fi	fidone		printf "Bye..." 

⌨️ 快捷键说明

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