Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR SHELL

bash array append

for i in $(seq 2.5 .1 5);
do
    # Print the value
    echo $i " ########";
    arrVar+=($i) # appending 

done

# Iterate the loop to read and print each array element
for value in "${arrVar[@]}"
do
     echo $value
done

other ways : https://linuxhint.com/bash_append_array/


2.5
2.6
2.7
2.8
2.9
Source by linuxhint.com #
 
PREVIOUS NEXT
Tagged: #bash #array #append
ADD COMMENT
Topic
Name
8+7 =