@matheusbsbs / matheus-bagliano / commits / f5f30699c0
Fork 0

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 <spearce@spearce.org>

Shawn O. Pearce committed Oct 16, 2007 at 21:33 UTC f5f30699c078be289daaabb61ed69e1f84747a78
1 file changed +1 -2
git-instaweb.sh
+1 -2
@@ -30,8 +30,7 @@ test -z "$port" && port=1234
30
31 start_httpd () {
32 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
34 then
35 $httpd $fqgitdir/gitweb/httpd.conf
36 else