Re: [PATCH 0/5] some shell portability fixes
From: Junio C Hamano <hidden>
Date: 2016-06-15 22:43:47
All missing Signed-off-by: lines.
[1/5] In addition to take advantage of the fact that the RHS of
assignment is not split, I'd prefer replacing `` with $()
with these cases. Much easier to read if your shell
supports it (and all the modern ones do).
[2/5] Gaah, AIX sed X-<. I am not opposed to this patch but
would want to get Yays from people with non GNU sed. Is
busybox sed good enough to grok our scripts these days?
Please ask help and collect Acks at least from folks on
Solaris, MacOS, FBSD, and OBSD.
[3/5] Arithmetic expansion. Have you caught _all_ of them, or
is this patch about only the ones you noticed?
We used to have expr all over the place as I was one of
the primary authors of our shell scripts, and I am
"80-ish" old fashioned. There was a long discussion on
scripts in the past and we ruled that $(( ... )) is easier
to read and supported widely enough to be acceptable.
This patch goes backwards. Will drop, unless you can
demonstrate that an implementation does not support it and
convince people that the implementation is important.
/bin/sh on Solaris does not count as you can configure
SHELL_PATH to point at xpg4 shell or ksh on that platform.
[4/5] I wonder if use of fgrep would be easier to read and more
portable with this one:
name=$( GIT_CONFIG=.gitmodules \
git config --get-regexp '^submodule\..*\.path$' |
fgrep "submodule.$1.path" |
sed -e 's/^submodule\.\(.*\)\.path$/\1/'
)
[5/5] Again, have you covered all of them? I am not opposed to
this one, although I am a bit curious who lacks -a/-o in
practice.