Skip to content

Commit f5f3069

Browse files
committed
Avoid 'expr index' on Mac OS X as it isn't supported
This fixes git-instaweb so it can start an httpd without warning about an invalid test command. Yes its ugly, but its also quite portable. Signed-off-by: Shawn O. Pearce <[email protected]>
1 parent 46eb449 commit f5f3069

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

git-instaweb.sh

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,7 @@ test -z "$port" && port=1234
3030

3131
start_httpd () {
3232
httpd_only="`echo $httpd | cut -f1 -d' '`"
33-
if test "`expr index $httpd_only /`" -eq '1' || \
34-
which $httpd_only >/dev/null
33+
if case "$httpd_only" in /*) : ;; *) which $httpd_only >/dev/null;; esac
3534
then
3635
$httpd $fqgitdir/gitweb/httpd.conf
3736
else

0 commit comments

Comments
 (0)