diff options
Diffstat (limited to 'bin/lowercase')
-rwxr-xr-x | bin/lowercase | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/bin/lowercase b/bin/lowercase new file mode 100755 index 0000000..09273b0 --- /dev/null +++ b/bin/lowercase @@ -0,0 +1,23 @@ +#!/bin/bash + +# lowerext.sh + +while read f; do + if [[ "$f" = *.* ]]; then + # Extract the basename + b="${f%.*}" + + # Extract the extension + x="${f##*.}" + + # Convert the extension to lower case + # Note: this only works in recent versions of Bash + l="${x,,}" + + if [[ "$x" != "$l" ]]; then + mv "$f" "$b.$l" + fi + else + continue + fi +done |