From faf6d158782ee331572e648759436ee3f2310f26 Mon Sep 17 00:00:00 2001 From: winlin Date: Mon, 21 Sep 2015 18:32:17 +0800 Subject: [PATCH] add replace script. --- trunk/scripts/sources_replace.sh | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100755 trunk/scripts/sources_replace.sh diff --git a/trunk/scripts/sources_replace.sh b/trunk/scripts/sources_replace.sh new file mode 100755 index 000000000..5b7667856 --- /dev/null +++ b/trunk/scripts/sources_replace.sh @@ -0,0 +1,26 @@ +#!/bin/bash + +from=$1 +to=$2 + +if [[ $from == '' ]]; then + echo "replace from must not be empty" + exit 1 +fi + +if [[ $to == '' ]]; then + echo "replace to must not be empty" + exit 1 +fi + +echo "from=$from" +echo "to=$to" + +files="configure `ls auto` `ls conf` `ls scripts` `find etc -type f` `find ide -type f` `find research -type f` `find src -type f`" +for file in $files; do + grep -in "$from" $file >/dev/null 2>&1; + if [[ 0 -eq $? ]]; then + echo "replace $file"; + #sed -i '' "s|$from|$to|g" $file; + fi; +done