14jun/111
How to convert a string to lower case or UPPER case with Bash
Ever had a situation where you want the output or input in a BASH script to be lowercase or uppercase whatever happens but you couldn't find a way how to do that? You can!
Simply, use these two functions in your script:
1 2 3 4 5 6 7 8 9 10 | toLower() { echo $1 | tr "[:upper:]" "[:lower:]" } toUpper() { echo $1 | tr "[:lower:]" "[:upper:]" } # Example echo `toUpper hey` echo `toLower HEY` |
I hope this helps you out with writing your precious script




