Eric Blake said:
> ....  Just go with:
> X=`echo "$X" | sed 's/[, ].*//'`

The "sed" is nice and clear.

However, that "echo" will probably cause trouble if $X starts with "-" or has 
other characters in it.
I presume in this case that $X will *usually* start with "-", so you REALLY 
don't want to use echo directly.
Unless $X can *only* contain alphanumerics, I suggest replacing echo "$X" with:
 printf '%s\n' "$X"
An alternative would be to use AS_ECHO.

Dale Visser, you might want to look here:
 
https://www.gnu.org/savannah-checkouts/gnu/autoconf/manual/autoconf-2.69/html_node/Portable-Shell.html
and especially:
 
https://www.gnu.org/savannah-checkouts/gnu/autoconf/manual/autoconf-2.69/html_node/Limitations-of-Builtins.html

--- David A. Wheeler

_______________________________________________
Autoconf mailing list
Autoconf@gnu.org
https://lists.gnu.org/mailman/listinfo/autoconf

Reply via email to