example02.02

来自「UNIX[1].shell范例精解(第4版)_code」· 02 代码 · 共 32 行

02
32
字号
#!/bin/csh -f# The Party Program--Invitations to friends from the "guest" file #set guestfile = ~/shell/guestsset guestfile = ./guestsif ( ! -e "$guestfile" ) then	echo "$guestfile:t non-existent"	exit 1endifsetenv PLACE "Sarotini's"@ Time = `date +%H` + 1set food = ( cheese crackers shrimp drinks "hot dogs" sandwiches )foreach person ( `cat $guestfile` )if ( $person =~ root ) continuemail -v -s "Party" $person << FINIS   # Start of here documentHi $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 $food[1] 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`       # or `uname -n`FINISshift foodif ( $#food ==  0 ) then	set food = ( cheese crackers shrimp drinks "hot dogs" 	             sandwiches )endifend		echo "Bye..." 

⌨️ 快捷键说明

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