• 0 Posts
  • 14 Comments
Joined 2 years ago
cake
Cake day: June 16th, 2023

help-circle












  • BlackOaktoLinux@lemmy.mlConverting space separated string to array
    link
    fedilink
    English
    arrow-up
    1
    ·
    edit-2
    2 years ago

    While I do agree that bash isn’t really the best tool for the job when working with XML data, there is a simple enough solution.

    $ read -r -a arraytest <<< "2023-06-19T00:00:00+01:00 2023-06-18T00:00:00+01:00 2023-06-17T00:00:00+01:00 2023-06-16T00:00:00+01:00 2023-06-15T00:00:00+01:00 2023-06-14T00:00:00+01:00 2023-06-13T00:00:00+01:00 2023-06-10T00:00:00+01:00 2023-06-03T00:00:00+01:00 2023-05-31T00:00:00+01:00 2023-05-27T00:00:00+01:00"

    $ for ds in "${arraytest[@]}"; do echo "$ds"; done;