Skip to content

Commit

Permalink
Use printf rather than echo -n.
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Jason Riedy authored and Junio C Hamano committed Dec 7, 2005
1 parent e23eff8 commit 9754563
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion git-am.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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 ;;
Expand Down
2 changes: 1 addition & 1 deletion git-applypatch.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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;;
Expand Down
2 changes: 1 addition & 1 deletion git-bisect.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
4 changes: 2 additions & 2 deletions git-status.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ report () {
trailer=""
while read status name newname
do
echo -n "$header"
printf '%s' "$header"
header=""
trailer="#
"
Expand All @@ -27,7 +27,7 @@ report () {
U ) echo "# unmerged: $name";;
esac
done
echo -n "$trailer"
printf '%s' "$trailer"
[ "$header" ]
}

Expand Down

0 comments on commit 9754563

Please sign in to comment.