Use printf rather than echo -n.
authorJason Riedy <ejr@EECS.Berkeley.EDU>
Tue, 6 Dec 2005 22:21:52 +0000 (14:21 -0800)
committerJunio C Hamano <junkio@cox.net>
Wed, 7 Dec 2005 02:09:12 +0000 (18:09 -0800)
On AIX, there is no -n option to the system's echo.  Instead,
it needs the '\c' control character.  We could replace
  echo -n "foo"
with
  echo -e "foo\c"
but printf is recommended by most man pages.  Tested on AIX
5.3, Solaris 8, and Debian.

[jc: futureproofed two instances that uses variable with '%s'
 so later feeding different messages would not break things too
 easily; others are emitting literal so whoever changes the
 literal ought to notice more easily so they are safe.]

Signed-off-by: E. Jason Riedy <ejr@cs.berkeley.edu>
Signed-off-by: Junio C Hamano <junkio@cox.net>
git-am.sh
git-applypatch.sh
git-bisect.sh
git-status.sh

index 660b3a4..6ed527c 100755 (executable)
--- a/git-am.sh
+++ b/git-am.sh
@@ -312,7 +312,7 @@ do
                echo "--------------------------"
                cat "$dotest/final-commit"
                echo "--------------------------"
-               echo -n "Apply? [y]es/[n]o/[e]dit/[v]iew patch/[a]ccept all "
+               printf "Apply? [y]es/[n]o/[e]dit/[v]iew patch/[a]ccept all "
                read reply
                case "$reply" in
                [yY]*) action=yes ;;
index 4c577eb..a112e1a 100755 (executable)
@@ -83,7 +83,7 @@ while [ "$interactive" = yes ]; do
        echo "--------------------------"
        cat "$final"
        echo "--------------------------"
-       echo -n "Apply? [y]es/[n]o/[e]dit/[a]ccept all "
+       printf "Apply? [y]es/[n]o/[e]dit/[a]ccept all "
        read reply
        case "$reply" in
                y|Y) interactive=no;;
index 68838f3..05dae8a 100755 (executable)
@@ -67,7 +67,7 @@ bisect_start() {
        rm -rf "$GIT_DIR/refs/bisect/"
        mkdir "$GIT_DIR/refs/bisect"
        {
-           echo -n "git-bisect start"
+           printf "git-bisect start"
            sq "$@"
        } >"$GIT_DIR/BISECT_LOG"
        sq "$@" >"$GIT_DIR/BISECT_NAMES"
index b90ffc1..2dda0c5 100755 (executable)
@@ -13,7 +13,7 @@ report () {
   trailer=""
   while read status name newname
   do
-    echo -n "$header"
+    printf '%s' "$header"
     header=""
     trailer="#
 "
@@ -27,7 +27,7 @@ report () {
     U ) echo "#        unmerged: $name";;
     esac
   done
-  echo -n "$trailer"
+  printf '%s' "$trailer"
   [ "$header" ]
 }