Sunday, 8 February 2015

Uppercase and Lowercase Conversion - Bash Style

After a long long time, I am back with this short post to convert case of strings in bash. While you might have been using tr (Like I did for a while) for this purpose, bash 4 has a built-in way for the case conversion. Withour further ado, here is a session
$ x="samar"

$ echo "${x^}"
Samar

$ echo "${x^^}"
SAMAR

$ y="${x^^}"

$ echo $y
SAMAR

$ echo "${y,}"
sAMAR

$ echo "${y,,}"
samar


I hope this helps ;)

1 comment:

Richie Ray said...

I really enjoyed discovering Letras Diferentes
because it offers a simple and creative way to make text more stylish and distinctive. The variety of font designs makes it easy to find something that matches different personalities and occasions. It can be especially useful for social media bios, usernames, captions, messages, and personal projects. I also appreciate how convenient it is to explore different styles without needing any special design skills. Overall, Letras Diferentes is a fun and practical resource for anyone who wants to personalize their online content.

Post a Comment