Skip to content

Instantly share code, notes, and snippets.

@derektamsen
Created March 10, 2015 19:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save derektamsen/ff955c087430b80c4eb8 to your computer and use it in GitHub Desktop.
Save derektamsen/ff955c087430b80c4eb8 to your computer and use it in GitHub Desktop.
These aliases help convert text from upper case to lower case with 'upper2lower' or lower case to upper case with 'lower2upper'. This will handle mixed case and ensure the output is all lower or all upper. It also ignores any non-alpha characters and includes them in the output.
#!/usr/bin/env sh
upper2lower () {
echo "${@}" | tr '[:upper:]' '[:lower:]'
}
lower2upper () {
echo "${@}" | tr '[:lower:]' '[:upper:]'
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment