Skip to content

Commit

Permalink
Avoid 'expr index' on Mac OS X as it isn't supported
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Shawn O. Pearce committed Oct 17, 2007
1 parent 46eb449 commit f5f3069
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions git-instaweb.sh
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,7 @@ test -z "$port" && port=1234

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

0 comments on commit f5f3069

Please sign in to comment.