change.sh
来自「Finite element program for mechanical pr」· Shell 代码 · 共 48 行
SH
48 行
#!/bin/bash# execution path: *# parameter: files (file.1 file.2, file.* , *.in *.cpp , *.* , ...)# function: v aktualnim adresari prohleda vsechny specifikovane soubory# a vsechny retezce 'old' nahradi retezcem 'new'# request: v retezci 'old' musi byt "regularni vyraz"# v retezci 'new' musi byt "obycejny vyraz"# Set this strings, please :old='\/\* adaptivity \*\/'new='\/\* termitovo \*\/'if [ -z $old ]; then echo "Set string 'old' within file 'change.sh' !!!"; exit 1; fiif [ -z $@ ]; then echo "Set parameter, please !!!"; exit 1; fiall=''all1=''for i in $@ ; do all1=`find . \! -type d -name $i` all="$all $all1"doneecho 'checked files:'echo $allecho 'changed files:'for file in $all; do sed s/"$old"/"$new"/g $file > aux.txt if `cmp -s $file aux.txt` then rm -f aux.txt else mv aux.txt $file echo $file fidoneexit 0
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?