Shell question: how to preserve newlines when process output is assigned to variable?

Lowell Gilbert freebsd-questions-local at be-well.ilk.org
Mon Dec 1 23:50:19 UTC 2014


Yuri <yuri at rawbw.com> writes:

> When script has the line like this:
> VAR=$(ls)
> all newlines returned by the process (ls) are removed.

I don't think so.

If you process the variable's contents one line at a time,
you will get a separate line for each file.


More information about the freebsd-questions mailing list