1234567891011121314151617181920212223242526272829303132333435363738394041 |
- #!/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
- if git status | grep -v --quiet "nothing to commit, working directory clean"
- then
- echo "Error: git is not committed or not clean"
- exit 1
- fi
|