K
K
k0r0g2021-10-16 10:08:43
bash
k0r0g, 2021-10-16 10:08:43

How to iterate over the characters of a string in bash?

Actually the question is in the title.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
AVKor, 2021-10-16
@k0r0g

Here .

A
Alexander Karabanov, 2021-10-16
@karabanov

string=test
for item in $(echo -n $string | sed 's/./&\n/g'); do echo $item; done
t
e
s
t

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question