Skip to content

Instantly share code, notes, and snippets.

@coderofsalvation
Last active November 27, 2018 02:30
Show Gist options
  • Select an option

  • Save coderofsalvation/8919386 to your computer and use it in GitHub Desktop.

Select an option

Save coderofsalvation/8919386 to your computer and use it in GitHub Desktop.
print first character in capital
# 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