Sfoglia il codice sorgente

change name script

Former-commit-id: b3e4398f6773c461640223cb2e65ed916299ea63
Alec Jacobson 11 anni fa
parent
commit
280dc926d8
1 ha cambiato i file con 35 aggiunte e 0 eliminazioni
  1. 35 0
      scripts/change_name.sh

+ 35 - 0
scripts/change_name.sh

@@ -0,0 +1,35 @@
+#!/bin/bash
+
+if [ "$#" -lt 2 ]
+then
+  USAGE="Usage:
+  scripts/name_change.sh old_name new_name";
+  echo "$USAGE"
+  exit 1
+fi
+
+old="$1"
+new="$2"
+
+old_cpp=`find . -name "$old.cpp"`
+if [ -z "$old_cpp" ]
+then
+  echo "Error: $old.cpp does not exist."
+  exit 1
+fi
+
+old_h=`find . -name "$old.h"`
+if [ -z "$old_h" ]
+then
+  echo "Error: $old.h does not exist."
+  exit 1
+fi
+
+grep -rI "$old" *
+
+read -r -p "Are you sure? [y/N] " response
+if [[ ! $response =~ ^([yY][eE][sS]|[yY])$ ]]
+then
+  exit 1
+fi
+