tladeras’s avatartladeras’s Twitter Archive—№ 6,189

          1. This little shell script took forever to learn and write. Because all of the little parts don't make spatial sense to me: while IFS=$"\n" read -r i; do dx terminate $i done <<< $my_array
        1. …in reply to @tladeras
          What does it do? It takes a newline separated array of jobs ($my_array), cycles through them as an array and terminates them. It's the IFS=$"\n" read -r i And the <<< $my_array That really bug me.
      1. …in reply to @tladeras
        It's hard to google the first. And the second kind of makes we want to scream. This has been an episode of Ted muddles his way through shell scripting.
    1. …in reply to @tladeras
      (I'm sure this is second nature for some bash heads; I just wanted to highlight something I found very difficult to learn.)
  1. …in reply to @tladeras
    For added info, the first line changes the Internal File Separator, so it will treat each newline as a separator, allowing you to cycle through the list of newline separated files. The second is directing the contents of $my_array into the while loop; it's kind of ugh for me.