juandesant,
@juandesant@astrodon.social avatar

Today I learned how to split a variable with multiple lines for a Bash/ZSH script. I was using the previously mentioned mdb-query package, and I have a variable named tables with the different tables, separated by returns. When I fried to do for table in $tables; do echo $table; done, it did not split the lines.

I got the right output with

while IFS= read -r table; do $table; done <<< $tables

The spacing is important!

From https://superuser.com/a/284226/199266

  • All
  • Subscribed
  • Moderated
  • Favorites
  • til
  • DreamBathrooms
  • mdbf
  • ethstaker
  • magazineikmin
  • cubers
  • rosin
  • thenastyranch
  • Youngstown
  • InstantRegret
  • slotface
  • osvaldo12
  • kavyap
  • khanakhh
  • Durango
  • megavids
  • everett
  • tacticalgear
  • modclub
  • normalnudes
  • ngwrru68w68
  • cisconetworking
  • tester
  • GTA5RPClips
  • Leos
  • anitta
  • provamag3
  • JUstTest
  • lostlight
  • All magazines