Skip to content

Instantly share code, notes, and snippets.

@mikesorae
Last active April 26, 2016 09:42
Show Gist options
  • Save mikesorae/54e8383e8d49037463c8b87e6043a6e1 to your computer and use it in GitHub Desktop.
Save mikesorae/54e8383e8d49037463c8b87e6043a6e1 to your computer and use it in GitHub Desktop.
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