📄 copycheck
字号:
#!/bin/csh -f# script to check a single source file for the copyright message(s)if ( "$1" == "" ) then echo "usage: $0 filename" exitendif# echo which file we're working withecho $1# strings to insertset terms_string = "Terms of use are as specified in license.txt."set cpr_string = "// copyright Scott McPeak, 1999"# check for existence of a copyright messageset msgs = `grep -i copyright $1 | wc -l`if ( "$msgs" == "0" ) then echo " There is no copyright message." # check for (c) instead set msgs = `grep -i "(c)" $1 | wc -l` if ( "$msgs" == "1" ) then echo " Replacing (c) with copyright." mv -i $1 ${1}.old1 cat ${1}.old1 | sed 's/(c)/copyright/g' > $1 else if ( "$msgs" > "1" ) then echo " There is more than one (c)" exit 2 else echo " Inserting a copyright and terms-of-use string" mv -i $1 ${1}.old1 head -2 ${1}.old1 > $1 echo "${cpr_string} ${terms_string}" >> $1 tail +3 ${1}.old1 >> $1 endifelse if ( "$msgs" > "1" ) then echo " There is more than one copyright message" exit 2else echo " Copyright message is ok"endif# at this point, there is known to be exactly one line with# the string 'copyright' in it; get itset msg = `grep -i copyright $1`# does the terms of use notice appear?set terms = `echo "$msg" | grep -i "Terms of use" | wc -l`if ( "$terms" == "0" ) then echo " Inserting terms-of-use" mv -i $1 ${1}.old2 cat ${1}.old2 | sed "s#${msg}#${msg} ${terms_string}#" > $1else if ( "$terms" > "1" ) then echo " There is more than one terms-of-use" exit 2else echo " Terms-of-use is ok"endif# ok, all seems in order hereexit 0
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -