winlin

add replace script.

  1 +#!/bin/bash
  2 +
  3 +from=$1
  4 +to=$2
  5 +
  6 +if [[ $from == '' ]]; then
  7 + echo "replace from must not be empty"
  8 + exit 1
  9 +fi
  10 +
  11 +if [[ $to == '' ]]; then
  12 + echo "replace to must not be empty"
  13 + exit 1
  14 +fi
  15 +
  16 +echo "from=$from"
  17 +echo "to=$to"
  18 +
  19 +files="configure `ls auto` `ls conf` `ls scripts` `find etc -type f` `find ide -type f` `find research -type f` `find src -type f`"
  20 +for file in $files; do
  21 + grep -in "$from" $file >/dev/null 2>&1;
  22 + if [[ 0 -eq $? ]]; then
  23 + echo "replace $file";
  24 + #sed -i '' "s|$from|$to|g" $file;
  25 + fi;
  26 +done