summaryrefslogtreecommitdiff
path: root/scripts/replace.sh
blob: 7912c72d645ed6fe1bb9da8af1aea01d915c8087 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
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/