From 5a125fac96e5045ea22bc97272f080ca03836b38 Mon Sep 17 00:00:00 2001 From: Sitaram Chamarty Date: Thu, 20 Oct 2011 15:40:17 +0530 Subject: [PATCH] It's official now; Solaris sh is brain dead... For example, this program #!/bin/sh die() { echo die called with $1; exit 1; } >&2 die foo die bar will print *both* those messages! I honestly don't care if this is posix or not, but it is BRAIN DEAD for the ">&2" to change the meaning from {} to () Oh and the grep thing is even worse. echo foo | grep ^/ works fine in an interactive shell but in a script it attempts to *execute* "/", complains, while simultaneously complaining about usage of grep. It's almost like it's treating ^ like | --- hooks/gitolite-admin/post-update | 2 +- src/gl-admin-push | 2 +- src/gl-setup | 2 +- src/gl-system-install | 4 ++-- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/hooks/gitolite-admin/post-update b/hooks/gitolite-admin/post-update index 98c0dcd..868ab4d 100755 --- a/hooks/gitolite-admin/post-update +++ b/hooks/gitolite-admin/post-update @@ -1,6 +1,6 @@ #!/bin/sh -die() { echo "$@"; exit 1; } >&2 +die() { echo "$@" >&2; exit 1; } [ -z "$GL_RC" ] && die "ENV GL_RC not set" [ -z "$GL_BINDIR" ] && die "ENV GL_BINDIR not set" diff --git a/src/gl-admin-push b/src/gl-admin-push index 4e2a073..3fd0214 100755 --- a/src/gl-admin-push +++ b/src/gl-admin-push @@ -1,6 +1,6 @@ #!/bin/sh -die() { echo "$@"; exit 1; } >&2 +die() { echo "$@" >&2; exit 1; } # ---------- diff --git a/src/gl-setup b/src/gl-setup index a18b60b..6215474 100755 --- a/src/gl-setup +++ b/src/gl-setup @@ -18,7 +18,7 @@ GL_PACKAGE_CONF=/tmp/share/gitolite/conf # pubkey file if you happen to have lost all gitolite-access to the repos (but # do have shell access via some other means) -die() { echo "$@"; exit 1; } >&2 +die() { echo "$@" >&2; exit 1; } get_rc_val() { `dirname $0`/gl-query-rc $1 diff --git a/src/gl-system-install b/src/gl-system-install index 296ab4f..6465fdf 100755 --- a/src/gl-system-install +++ b/src/gl-system-install @@ -29,10 +29,10 @@ usage() { echo " exit 1; } -die() { echo "$@"; echo; usage; exit 1; } >&2 +die() { echo "$@" >&2; echo >&2; usage >&2; exit 1; } validate_dir() { - echo $1 | grep ^/ >/dev/null || die "$1 should be an absolute path" + echo $1 | grep '^/' >/dev/null || die "$1 should be an absolute path" [ -d $1 ] || mkdir -p $1 || die "$1 does not exist and could not be created" }