Issue
I am trying to make an array that will have 84x28 values. The array should contain the number 1 repeated 28 times, followed by the number 2 repeated 28 times, and so on up until the number 84 repeated 28 times. I want the output to consist of 1 column and 84x28 rows, each for each number. Is there a way I can get started with this?
Solution
Use nested for
loops that append to the array.
#!/bin/bash
array=()
for i in {1..84}; do
for j in {1..28}; do
array+=($i)
done
done
echo "${array[@]}"
Answered By - Barmar Answer Checked By - Willingham (WPSolving Volunteer)