Answers for "bash add file to array"

5

bash adding to array

#!/bin/bash

#Making an array
array=(1 2 3)

#Appending the array
array+=(4)

#Printing the array
echo ${array[@]}
Posted by: Guest on February-24-2021
0

how to put the contents of a file into an array in bash

IFS=$'\n' read -d '' -r -a lines < /path/to/file
Posted by: Guest on November-02-2020

Code answers related to "Shell/Bash"

Browse Popular Code Answers by Language