* Gary V. Vaughan wrote on Tue, Jun 29, 2010 at 08:30:43PM CEST: > On 30 Jun 2010, at 01:22, Ralf Wildenhues wrote: > > I think m4sh can simply use code like > > > > if ( eval '$smart_works' ) >/dev/null 2>&1; then > > func_foo () { smart code; } > > else > > func_foo () { safe code; } > > fi > > > > for code run a handful of times, without need for extra m4 magic, it's > > just that libtool is easily run hundreds of times in a typical large > > software build so it warrants optimization. > > In that case might the retarded shell choke and die as it parses 'smart > code;'?
Good point. IIRC gnulib-tool uses e.g., eval 'func_foo () { smart code; }' or eval inside the smart code, to get around that where needed. > I don't actually know whether retarded shells mostly ignore the code > during parsing, and can be reliably fed what they would otherwise consider > garbage as long they are never instructed to execute the garbage... but > it seems like something we'd need to be very careful about. Just trying it with Solaris sh and maybe a couple of the other vendor systems helps, these things are easily sorted out with your level of system access. Cheers, Ralf