bash: Use read to create an array.



  • Take into account the main readme for this section. README first.

    Define the array. IFS is used to preserve spaces.

    $ IFS= read -d '' -a my_array < <(netstat)
    

    Basic example of using the array.

    $ for line in "${my_array[@]}"; do echo "$line"; done
    

Log in to reply
 

© Lightnetics 2024