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:

Note to self - use kubectl to query images in a pod or deployment

In both cases, we use JSON ... For a deployment, we can do this: - kubectl get deployment foobar --namespace snafu --output jsonpath="{...