updatedb

来自「<B>Digital的Unix操作系统VAX 4.2源码</B>」· 代码 · 共 37 行

TXT
37
字号
#!/bin/csh -f##	@(#)updatedb.csh	4.4	(Berkeley)	83/07/21#set SRCHPATHS = "/"			# directories to be put in the databaseset LIBDIR = /usr/lib/find		# for subprogramsset FINDHONCHO = root			# for error messagesset FCODES = /usr/lib/find/find.codes	# the database set path = ( $LIBDIR /usr/ucb /bin /usr/bin )set bigrams = /tmp/f.bigrams$$set filelist = /tmp/f.list$$set errs = /tmp/f.errs$$# Make a file list and compute common bigrams.# Alphabetize '/' before any other char with 'tr'.# If the system is very short of sort space, 'bigram' can be made# smarter to accumulate common bigrams directly without sorting# ('awk', with its associative memory capacity, can do this in several# lines, but is too slow, and runs out of string space on small machines).nice +10find ${SRCHPATHS} -print | tr '/' '\001' | \   (sort -f; echo $status > $errs) | \   tr '\001' '/' | tee $filelist | $LIBDIR/bigram | \   (sort; echo $status >> $errs) | uniq -c | sort -nr | \   awk '{ if (NR <= 128) print $2 }' | tr -d '\012' > $bigrams# code the file listif { grep -s -v 0 $errs } then	echo 'squeeze error: out of sort space' | mail $FINDHONCHOelse	$LIBDIR/code $bigrams < $filelist > $FCODES	rm $bigrams $filelist $errsendif

⌨️ 快捷键说明

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