From: Chris Ridd Date: Wed, 11 Jun 2008 13:09:19 GMT Subject: [PATCH] Improve sed portability Message-ID: <1213189759-11565-1-git-send-email-chris.ridd@isode.com> On Solaris /usr/bin/sed apparently fails to process input that doesn't end in a \n. Consequently constructs like re=$(printf '%s' foo | sed -e 's/bar/BAR/g' $) cause re to be set to the empty string. Such a construct is used in git-submodule.sh. Changing the printf to add a \n seems the safest change. The POSIX-compliant seds shipped with Solaris do not have this problem. Signed-off-by: Chris Ridd --- git-submodule.sh | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/git-submodule.sh b/git-submodule.sh index 1007372..e515bcc 100755 --- a/git-submodule.sh +++ b/git-submodule.sh @@ -73,7 +73,7 @@ resolve_relative_url () module_name() { # Do we have "submodule..path = $1" defined in .gitmodules file? - re=$(printf '%s' "$1" | sed -e 's/[].[^$\\*]/\\&/g') + re=$(printf "%s\n" "$1" | sed -e 's/[].[^$\\*]/\\&/g') name=$( git config -f .gitmodules --get-regexp '^submodule\..*\.path$' | sed -n -e 's|^submodule\.\(.*\)\.path '"$re"'$|\1|p' ) test -z "$name" && -- 1.5.3.6