How to convert a string to lower case in Bash?

The are various ways: POSIX standard tr AWK Non-POSIX You may run into portability issues with the following examples: Bash 4.0 sed Perl Bash Note: YMMV on this one. Doesn’t work for me (GNU bash version 4.2.46 and 4.0.33 (and same behaviour 2.05b.0 but nocasematch is not implemented)) even with using shopt -u nocasematch;. Unsetting that … Read more

How do I lowercase a string in C?

It’s in the standard library, and that’s the most straight forward way I can see to implement such a function. So yes, just loop through the string and convert each character to lowercase. Something trivial like this: or if you prefer one liners, then you can use this one by J.F. Sebastian: