2 Replies Latest reply on Apr 27, 2019 11:42 AM by Dude!

    from file to array using tail

    happy10319

      Hi,

      I have a text file:

      more users.txt

      user1

      user2

      user3

       

      I want to construct an array from it.

      ~$ IFS=' '

      ~$ result=$(tail -4 users.txt)

      ~$ set -a array_result $result

      :~$ echo text contenu: ${result[@]} Number: ${#array_result[@]}

      text contenu: user1

      user2

      user3 Number: 0

       

      My question:

      Why zero element in array?

       

      Thank you.