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

📄 sorts

📁 早期freebsd实现
💻
字号:
#! /bin/csh -f#	$Header: mail.sort,v 2.5 87/09/19 05:55:23 jerryp Exp $##  ...USE csh BECAUSE OF msgs[1] AND shift msgs FEATURES...### Revised Sept. 1989 Mark-Jason Dominus.## New usage:  sorts [-[no]verbose] [-[no]fold] [+folder] [msgs]#umask 77	# PROTECT TEMPORARY FILE WITH -rw------- MODEset mhdir = /usr/local/mhset temp = /tmp/MSORT$$##set theFolder = \##	 '+'`grep '^Current-Folder' $HOME/mail/context | sed -e 's/.*: //'`## Following code installed 13-14 Sept. 1989 M-J. Dominus##Default arguments:#  Which folder to sort?  Default = current folder.set theFolder = `folder -fast`#  Get help?  Default:  No help.set helpflag = 0#  Verbose sort?  Default:  Shut up.set vflag = 0#  Case-sensitive sort?  Default: Yep.set foldflag = '-f'#  Which messages?  Default: allset theMessages = 'all'# Add support for an arglist like:  sorts 4-6 8 12-23.# The *FIRST* time you see a nonflag argument, _set_ theMessages = argument.# *AFTER* the first time, _append_ the argument to theMessages.set firstMsgArg = 1## .mh_profile lines override default options.##echo "argv before profile is $argv"set profileLine = `grep -i '^sorts' $HOME/.mh_profile | sed -e 's/.*: //'` set argv = ($profileLine $argv)#echo "argv after profile is $argv"## Command-line arguments override .mh_profile and ordinary defaults.#while ("$argv" != '')  if      ("$1" == '-verbose') then	set vflag = 1  else if ("$1" == '-noverbose') then	set vflag = 0  else if ("$1" == '-fold') then	set foldflag = '-f'  else if ("$1" == '-nofold') then	set foldflag = ''  else if ("$1" =~ +* ) then# Measure twice, cut once. -D.	set theFolder = `echo $1 | cut -c2-`  else if ("$1" == '-help') then	set helpflag = 1  else	if ("$firstMsgArg" == '1') then		set theMessages = "$1"		set firstMsgArg = 0	else		set theMessages = ($theMessages $1)	endif  endif  shiftendif ($helpflag) then	cat <<END_OF_HELPsyntax: sorts [+folder] [msgs] [switches]  switches are:  -[no]verbose  -[no]fold  -(help)END_OF_HELP	exitendif# End of 14 Sept. 1989 argument-parsing additions.  M-J.D.# REMOVE GAPS BEFORE SORTING (IGNORE folder'S OUTPUT):# # Commented out 14 Sept. 1989 M-J.D.##$mhdir/folder -pack '+'$theFolder >& /dev/null##if ($vflag) echo "folder '`$mhdir/folder -fast`' packed for sorting"#if ($vflag) echo "folder +$theFolder packed for sorting"# GET MESSAGE NUMBERS AND SUBJECTS # THIS OLD STUFF WAS TO OVERRIDE USER'S PROFILE SWITCHES....# NOW NEED TO REVISE THIS TO USE scan FORMAT FILE!!# DELETE "Re:" AND STARTS OF BODIES (<<etc. etc.) FROM SUBJECT FIELDS:if ($vflag) echo "scanning folder for message numbers and subjects"#$mhdir/scan -noheader -nonumdate -nosize -notime $argv | cut -c1-4,30- | \$mhdir/scan -noheader '+'$theFolder $theMessages | cut -c1-4,30- | \	sed -e 's/^\(......\)[Rr][Ee]:[ 	]*/\1/' -e 's/<<.*//' > $tempset msgs = "`colrm 5 < $temp`"# cd TO CURRENT MAIL FOLDER, AND MAKE TEMPORARY DIRECTORY:set foldir = `$mhdir/mhpath`chdir $foldirmkdir MaIlSoRt$$# GET LIST OF MESSAGES, IN ORDER, BY DATE:if ($vflag) echo "sorting messages into temporary sub-folder:"foreach sortmsg (`sort $foldflag +1 $temp | colrm 5`)	# REMOVE LEADING BLANK ON $msgs[1]:	if ($vflag) echo -n "$sortmsg "	mv $sortmsg MaIlSoRt$$/`echo -n $msgs[1]`	shift msgsendif ($vflag) echo ""# MOVE SORTED MESSAGES INTO CURRENT FOLDER AND REMOVE TEMPORARY STUFF:if ($vflag) echo "moving messages back to original folder"cd MaIlSoRt$$mv * $foldirif ($status == 0) then	cd $foldir	rmdir MaIlSoRt$$	rm $tempendif

⌨️ 快捷键说明

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