Recommended way to truncate a shell variable value in autoconf

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



I have a macro argument that I would like to place in a shell variable, but with a catch. I want to truncate it at the first space or comma. I have code that works for me (in Ubuntu), like this:

    my_var="$1"
    my_var=${my_var%%\ *}
    my_var=${my_var%%,*}

However, I read at https://www.gnu.org/savannah-checkouts/gnu/autoconf/manual/autoconf-2.69/html_node/Shell-Substitutions.html#Shell-Substitutions that this construct "[does] not work with many traditional shells, e.g., Solaris 10 /bin/sh."

I am at a loss to figure out an acceptable "autoconf portable way" to accomplish this. I suspect some usage of m4_split (https://www.gnu.org/savannah-checkouts/gnu/autoconf/manual/autoconf-2.69/html_node/Text-processing-Macros.html#index-m4_005fsplit-1486) could be the answer, but haven't been able to figure out how to make it work correctly.

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




[Index of Archives]     [GCC Help]     [Kernel Discussion]     [RPM Discussion]     [Red Hat Development]     [Yosemite News]     [Linux USB]     [Samba]

  Powered by Linux