String to Uppercase using bash script – Code Example

In this article I will provide you code to convert your strings to all caps or uppercase using bash script. All caps strings are use in headings, titles, banners, posters etc. where a clear attention of customers is required. You can use our code example directly in your projects.

Code Example –

#!/bin/bash

upper() {
    echo "${1^^}"
}

upper "AN animAl is aN animal. DONKEY or DOG does NoT mAtTeR"

# Output:
# AN ANIMAL IS AN ANIMAL. DONKEY OR DOG DOES NOT MATTER

Inspired from Dylan Araps

Live Demo

Open Live Demo