Skip to content

Instantly share code, notes, and snippets.

@edwingustafson
Created December 16, 2024 14:00
Show Gist options
  • Save edwingustafson/f3142420438c78b3f1e92ab329331151 to your computer and use it in GitHub Desktop.
Save edwingustafson/f3142420438c78b3f1e92ab329331151 to your computer and use it in GitHub Desktop.
Capitalize string variable contents in Bash
#!/usr/bin/env bash
GREETING="hello, world!"
echo ${GREETING}
echo ${GREETING^}
echo ${GREETING^^}
exit 0
Sample output:
hello, world!
Hello, world!
HELLO, WORLD!
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment