Friday 2 December 2022

Reminder - how to split strings in a shell script

There's almost certainly 73 different ways to do this, but this worked for me

The problem to be solved ... I have a string containing three container architectures: -

export architecture="amd64 s390x arm64"

and I want to split it into three, each on a newline

This does the needful: -

echo $architecture | tr ";" "\n"

rather nicely

No comments:

Visual Studio Code - Wow 🙀

Why did I not know that I can merely hit [cmd] [p]  to bring up a search box allowing me to search my project e.g. a repo cloned from GitHub...