diff options
| -rwxr-xr-x | scripts/replace.sh | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/scripts/replace.sh b/scripts/replace.sh new file mode 100755 index 0000000..7912c72 --- /dev/null +++ b/scripts/replace.sh @@ -0,0 +1,25 @@ +#!/bin/sh + +# '@' - this char is prohibited to use +oldtext="$1" +newtext="$2" + +GoThroughDir() { + for D in $1*; do + if [ -d $D ] && [ "$D" == "./.git" ]; then + continue + elif [ -d $D ] && [ "$D" == "./build" ]; then + continue + elif [ -d $D ]; then + GoThroughDir $D/ + elif [ "$D" == "$0" ]; then + continue + else + sed -i -e "s@$oldtext@$newtext@" $D + fi + done +} + +GoThroughDir ./ + +grep -iHr "$oldtext" ./ | grep -v .git/ |