Skip to content

Instantly share code, notes, and snippets.

@mikesorae
Last active Apr 26, 2016
Embed
What would you like to do?
make a git tracked file lower
#!/bin/sh
if [ $# -eq 0 ]; then
echo "you need to pass a file or directory name to the command"
exit 1
fi
if [ ! -e $1 ]; then
echo "file not exists"
exit 1
fi
if [ ! -d $1 ]; then
echo "this is not a directory."
exit 1
fi
to_lower() {
input=$(echo $1 | tr '[A-Z]' '[a-z]')
echo $input
}
git_mv_lower() {
org=$(to_lower $1)
git mv $1 _tmp
git mv _tmp $org
}
git_mv_lower $1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment