📄 prepend
字号:
#! /bin/csh -f# script to prepend a single line of text to a text fileif ( "$2" == "" ) then echo "usage: $0 filename line-to-prepend" exitendif# grab filenameset fname = $1# shift arguments, so $* can refer to everythingshift# if file doesn't exist, just create it and bailif ( -e $fname ) then # it existselse echo $* > $fname exitendif# copy the existing file to a temporary file ($$ is pid)set tmp = /tmp/prepend.$$mv $fname $tmp# write the first lineecho $* > $fname# append the remainder of the original filecat $tmp >> $fname# remove the temporary filerm $tmp
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -