[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Assigning command output to a variable
From: |
Adam Mercer |
Subject: |
Re: Assigning command output to a variable |
Date: |
Mon, 19 Nov 2012 16:31:06 -0600 |
On Mon, Nov 19, 2012 at 12:36 PM, Eric Blake <address@hidden> wrote:
> You can avoid the command substitution fork by using read:
>
> { read redhat_release < /etc/redhat-release; } 2>/dev/null
>
> Whether that's deemed any simpler, though, is a matter of taste. Not to
> mention that use of 'read' like this is limited to cases where you know
> you are reading a one-line file (when present).
I believe this is the case... so this is an option.
Cheers
Adam