[PATCH 1/2] [TopGit] Portability: Use tr instead of sed for translating spaces to newlines

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



It is not portable to use \n in the replacement of a sed substitute
command.  On Mac OS X (and presumably FreeBSD, as Mac OS X uses
sed from FreeBSD), \n in the replacement of a substitution gives a
literal "n" instead of a newline.

This patch replaces the sed command with tr, which should be more
portable.

Signed-off-by: Brian Campbell <brian.p.campbell@xxxxxxxxxxxxx>
---
 tg-create.sh |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/tg-create.sh b/tg-create.sh
index 2edd537..ef9a955 100644
--- a/tg-create.sh
+++ b/tg-create.sh
@@ -116,7 +116,7 @@ done
 git update-ref "refs/top-bases/$name" "HEAD" ""
 git checkout -b "$name"
 
-echo "$deps" | sed 's/ /\n/g' >"$root_dir/.topdeps"
+echo "$deps" | tr ' ' '\n' >"$root_dir/.topdeps"
 git add -f "$root_dir/.topdeps"
 
 author="$(git var GIT_AUTHOR_IDENT)"
-- 
1.6.2.185.g8b635.dirty

--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux