S
S
sinneren2021-03-12 15:54:01
bash
sinneren, 2021-03-12 15:54:01

How to run an array in a loop in the console and use the value to execute the command at each iteration?

There is a list of some values, namely the names of closed git branches, for example:

br-123
br-345
br-1235


To delete all this every time executing the command lazily, I want to automate.
Therefore, the question is: how to make an array out of them for the console, and how to run it in a loop so that the array element is substituted into the command in branch_name?:git branch -d branch_name

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
Saboteur, 2021-03-12
@sinneren

for branch_name in br-123 br-345 br-1235
do
  blablabla
done

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question