threads / patch / 9847

patchRemove non-POSIX 'expr index' from instaweb.

Subject: [PATCH] Remove non-POSIX 'expr index' from instaweb.

## tl;dr

One message between Sep 14, 2007 and Sep 14, 2007. Diffs are folded; open one to read it.

replies: 0people: 1as markdown or json

Bryan Larsen· Sep 14, 2007, 22:01 UTC · lore

git-instaweb.sh uses the non-POSIX 'expr index' command, which is not present on some BSD's. This patch replaces this usage with a simple grep expression.

Signed-off-by: Bryan Larsen < bryan@larsen.st>
---
 git-instaweb.sh |    3 +--
 1 files changed, 1 insertions(+), 2 deletions(-)
Show changes to git-instaweb.sh +1 −2
diff --git a/git-instaweb.sh b/git-instaweb.sh
index ce631a0..ef1a4bf 100755
--- a/git-instaweb.sh
+++ b/git-instaweb.sh
@@ -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 test echo $http_only | grep ^/ || which $httpd_only >/dev/null
        then
                $httpd $fqgitdir/gitweb/httpd.conf
        else
-- 
1.5.3.1

← back to recent threads