On 08/17/2017 10:54 PM, Sam wrote: > Could I use regular match in AT_CHECK? Like this: Please don't top-post on technical lists; it makes it harder to follow the conversation. > > m4_define([OVS_VSWITCHD_STOP], >> [AT_CHECK([/etc/init.d/openvswitch stop], [0], [stdout], []) >> AT_CHECK([[awk '/Killing ovsdb-server/' stdout | sed -e 's/[ ]*$//g']], That's a lot of typing and a waste of a process. Why not just use the shorter: AT_CHECK([sed -n '/Killing ovsdb-server/ s/ *$//p' stdout], (that is, using 'awk' as a longhand for 'grep' followed immediately by piping through 'sed' is pointless, when you can do it all in 'sed'; and using 'g' on a substitution anchored at the end of a line is pointless). >> [0], [Killing ovsdb-server ([0-9]*) AT_CHECK only does direct textual matches. But never fear - you can do filtering as part of your command to pre-process the actual text into something that will match your expected text - similar to how you are eating trailing space, you can also convert random pids into a stable placeholder, as in this example: AT_CHECK([sed -n '/Killing ovsdb-server/ { s/ *$//; s/[0-9]*/PID/; p }' stdout], [0], [Killing ovsdb-server (PID) -- Eric Blake, Principal Software Engineer Red Hat, Inc. +1-919-301-3266 Virtualization: qemu.org | libvirt.org
Attachment:
signature.asc
Description: OpenPGP digital signature
_______________________________________________ Autoconf mailing list Autoconf@xxxxxxx https://lists.gnu.org/mailman/listinfo/autoconf