In reality, $(…) captures entire output, but if you assign it in string context, only first line is available.
However, if used in list context, you can read all lines one by one.
Code:
for f in $( printf "%d\\n" 1 2 3 ); do echo "$f"; done
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.