You're viewing a comment by Dave Eddy and its responses.

June 08, 2012, 10:51

Be careful with using this feature of bash, as it requires bash version 4 or higher. So on a mac (including Lion), this functionality isn't there.

dave @ [ bahamas10 :: (Darwin) ] ~ $ echo "$BASH_VERSION"
3.2.48(1)-release
dave @ [ bahamas10 :: (Darwin) ] ~ $ echo "${BASH_VERSION^^}"
-bash: ${BASH_VERSION^^}: bad substitution
dave @ [ bahamas10 :: (Darwin) ] ~ $ 

The only safe way to do this in older versions of bash is to use tr, and even then, to make sure you are using a locale-safe way of translating text.

ex.

dave @ [ bahamas10 :: (Darwin) ] ~ $ echo "$BASH_VERSION" | tr '[[:lower:]]' '[[:upper:]]'
3.2.48(1)-RELEASE

Ugly, I know, but safe.

Reply To This Comment

(why do I need your e-mail?)

(Your twitter name, if you have one. (I'm @pkrumins, btw.))

Type the word "coding": (just to make sure you're a human)

Please preview the comment before submitting to make sure it's OK.