Created
October 1, 2020 23:57
-
-
Save spiashko/cc8d3a05ceda5b9e5c4d8c10e2b44578 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
ENTITY_NAME=$1 | |
NEW_ENTITY_NAME=$2 | |
find . -name "$ENTITY_NAME*.java" \ | |
-exec rename -n 's,'"$ENTITY_NAME"'(.*).java,'"$NEW_ENTITY_NAME"'$1.java,i' {} \; | |
read -p "Are you sure? " -n 1 -r | |
echo # (optional) move to a new line | |
if [[ $REPLY =~ ^[Yy]$ ]] | |
then | |
find . -name "$ENTITY_NAME*.java" \ | |
-exec rename 's,'"$ENTITY_NAME"'(.*).java,'"$NEW_ENTITY_NAME"'$1.java,i' {} \; | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment