On 02/21/2014 05:05 PM, Dale Visser wrote: >> Date: Fri, 21 Feb 2014 16:57:28 -0700 >> From: eblake@xxxxxxxxxx >> To: dale.visser@xxxxxxxx; autoconf@xxxxxxx >> Subject: Re: Recommended way to truncate a shell variable value in autoconf >> >> 'string : regexp' is portable. 'match string regexp' is not. For >> example this use of expr is already present in pretty much any configure >> file generated by modern autoconf: >> >> as_echo_body='eval expr "X$1" : "X\\(.*\\)"' > > Good. I think I have settled on this, but will go back to the expr solution if you think that would be better: > > X=`echo "$X" | sed 's/ .*// ' | sed 's/,.*//'` sed|sed is a waste of a fork. Just go with: X=`echo "$X" | sed 's/[, ].*//'` -- Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org
Attachment:
signature.asc
Description: OpenPGP digital signature
_______________________________________________ Autoconf mailing list Autoconf@xxxxxxx https://lists.gnu.org/mailman/listinfo/autoconf