Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 01 Dec 2014 18:50:10 -0500
From:      Lowell Gilbert <freebsd-questions-local@be-well.ilk.org>
To:        Yuri <yuri@rawbw.com>
Cc:        FreeBSD Questions <freebsd-questions@freebsd.org>
Subject:   Re: Shell question: how to preserve newlines when process output is assigned to variable?
Message-ID:  <4461dvvsjx.fsf@lowell-desk.lan>
In-Reply-To: <547CF830.5000907@rawbw.com> (yuri@rawbw.com's message of "Mon, 01 Dec 2014 15:22:24 -0800")
References:  <547CF830.5000907@rawbw.com>

next in thread | previous in thread | raw e-mail | index | archive | help
Yuri <yuri@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.



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?4461dvvsjx.fsf>