Last active
November 27, 2018 02:30
-
-
Save coderofsalvation/8919386 to your computer and use it in GitHub Desktop.
print first character in capital
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # print first character in capital | |
| # usage: echo "hello" | ucfirst <-- outputs 'Hello' | |
| # | |
| # str="hello" | |
| # str="${str^}" <-- shortcut function | |
| ucfirst(){ | |
| l="$(cat -)"; echo "${l^}" | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment