1.防止误删除
mkdir -p ~/.trash
alias rm=delete
alias rl='ls -a ~/.trash'
alias ru=undelete
alias rc=cleartrash
delete() {
mv $@ ~/.trash/
}
undelete() {
mv -i ~/.trash/$@ ./
}
cleartrash() {
read -p "clear trash sure?[n]" confirm
[ $confirm == 'y' ] || [ $confirm == 'Y' ] && sudo /bin/rm -fr ~/.trash/*
}
2.去掉源文件中的注释和空行
alias comtd=comment
comment() {
mv $@ $@.cmtd
grep -v "^$" $@.cmtd |
grep -v "/*" |
grep -v " **" |
grep -v "//" >> $@
rm $@.cmtd
}