Thread (9 messages) flat view 9 messages, 2 authors, 2016-06-15

Re: [PATCH 1/2] config.mak.uname: Darwin: define HAVE_GETDELIM for modern OS X releases

From: Eric Sunshine <hidden>
Date: 2016-06-15 23:05:06

On Tue, Jun 2, 2015 at 3:04 PM, Jeff King [off-list ref] wrote:
On Tue, Jun 02, 2015 at 02:44:13PM -0400, Jeff King wrote:
quoted
quoted
+   ifeq ($(shell expr $(shell expr "$(uname_R)" : '\([0-9][0-9]*\)\.') '>=' 11),1)
Do you need to spawn two shells? It seems like:

  $(shell expr `expr "$(uname_R)" : '\([0-9][0-9]*\)'` '>=' 11),1)
I considered that and waffled on it. Either approach uses an extra
process, but I suppose `...` would likely be less expensive since it's
just forking the shell rather than exec()ing a new one.
Oops, I missed the trailing '.' in the regex there, and it probably
needs double-quotes in case the inner expr fails to match anything.
Which is messy considering the double quotes already surrounding
$(uname_R). Suggestions?
We could also use "test -gt" instead of the outer expr, which is more
idiomatic shell. But it reports via exit code, so you'd need "&& echo 1"
at the end.
Yes, I messed around with that as well but didn't want to stray too
far from existing practice.

I suppose the combination of `...` with built-in 'test' and built-in
'echo' would be the most efficient choice. Do you want it re-rolled?
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help