Created
June 6, 2016 11:12
-
-
Save thomasruiz/ed6cfd152508909ff31ab0753b1433e1 to your computer and use it in GitHub Desktop.
RM alias to confirm when directory has a git repository
This file contains 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
rm() { | |
export RM_VALIDATION='y' | |
for i | |
do | |
if [[ $i[1] != '-' ]]; then | |
if [[ -n `find $i -name .git` ]]; then | |
echo -n "There is a git repository. Are you sure? (y/N) " | |
read RM_VALIDATION | |
break | |
fi | |
fi | |
done | |
if [[ $RM_VALIDATION == 'y' ]]; then | |
/bin/rm $* | |
fi | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment