On 11/19/2012 10:09 AM, Adam Mercer wrote:
> Hi
> 
> For one of my projects I need to get the contents of
> /etc/redhat-release during the configure process and assign the
> contents to a variable. I'm currently using the following:
> 
>     redhat_release=`cat /etc/redhat-release 2> /dev/null`
> 
> This works fine, but I was wondering if anyone had any better suggestions?

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).

-- 
Eric Blake   [email protected]    +1-919-301-3266
Libvirt virtualization library http://libvirt.org

Attachment: signature.asc
Description: OpenPGP digital signature

_______________________________________________
Autoconf mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/autoconf

Reply via email to