Replace "echo -n" with printf in shell scripts.

Not all echos know -n.  This was causing a test failure in
t5401-update-hooks.sh, but not t3800-mktag.sh for some reason.

Signed-off-by: Jason Riedy <ejr@cs.berkeley.edu>
Signed-off-by: Junio C Hamano <junkio@cox.net>
This commit is contained in:
Jason Riedy 2007-01-15 17:31:29 -08:00 committed by Junio C Hamano
parent fb9522062c
commit 2aad957a51
6 changed files with 7 additions and 7 deletions

View File

@ -11,7 +11,7 @@ if [ -d "$GIT_DIR"/remotes ]; then
{ {
cd "$GIT_DIR"/remotes cd "$GIT_DIR"/remotes
ls | while read f; do ls | while read f; do
name=$(echo -n "$f" | tr -c "A-Za-z0-9" ".") name=$(printf "$f" | tr -c "A-Za-z0-9" ".")
sed -n \ sed -n \
-e "s/^URL: \(.*\)$/remote.$name.url \1 ./p" \ -e "s/^URL: \(.*\)$/remote.$name.url \1 ./p" \
-e "s/^Pull: \(.*\)$/remote.$name.fetch \1 ^$ /p" \ -e "s/^Pull: \(.*\)$/remote.$name.fetch \1 ^$ /p" \

View File

@ -89,7 +89,7 @@ for patch_name in $(cat "$QUILT_PATCHES/series" | grep -v '^#'); do
echo "No author found in $patch_name" >&2; echo "No author found in $patch_name" >&2;
echo "---" echo "---"
cat $tmp_msg cat $tmp_msg
echo -n "Author: "; printf "Author: ";
read patch_author read patch_author
echo "$patch_author" echo "$patch_author"

View File

@ -87,7 +87,7 @@ update_ref_status=$?
case "$reset_type" in case "$reset_type" in
--hard ) --hard )
test $update_ref_status = 0 && { test $update_ref_status = 0 && {
echo -n "HEAD is now at " printf "HEAD is now at "
GIT_PAGER= git log --max-count=1 --pretty=oneline \ GIT_PAGER= git log --max-count=1 --pretty=oneline \
--abbrev-commit HEAD --abbrev-commit HEAD
} }

View File

@ -88,7 +88,7 @@ check_verify_failure '"type" line label check'
# 5. type line eol check # 5. type line eol check
echo "object 779e9b33986b1c2670fff52c5067603117b3e895" >tag.sig echo "object 779e9b33986b1c2670fff52c5067603117b3e895" >tag.sig
echo -n "type tagsssssssssssssssssssssssssssssss" >>tag.sig printf "type tagsssssssssssssssssssssssssssssss" >>tag.sig
cat >expect.pat <<EOF cat >expect.pat <<EOF
^error: char48: .*"[\]n"$ ^error: char48: .*"[\]n"$

View File

@ -23,7 +23,7 @@ test_expect_success setup '
cat >victim/.git/hooks/update <<'EOF' cat >victim/.git/hooks/update <<'EOF'
#!/bin/sh #!/bin/sh
echo "$@" >$GIT_DIR/update.args echo "$@" >$GIT_DIR/update.args
read x; echo -n "$x" >$GIT_DIR/update.stdin read x; printf "$x" >$GIT_DIR/update.stdin
echo STDOUT update echo STDOUT update
echo STDERR update >&2 echo STDERR update >&2
EOF EOF
@ -32,7 +32,7 @@ chmod u+x victim/.git/hooks/update
cat >victim/.git/hooks/post-update <<'EOF' cat >victim/.git/hooks/post-update <<'EOF'
#!/bin/sh #!/bin/sh
echo "$@" >$GIT_DIR/post-update.args echo "$@" >$GIT_DIR/post-update.args
read x; echo -n "$x" >$GIT_DIR/post-update.stdin read x; printf "$x" >$GIT_DIR/post-update.stdin
echo STDOUT post-update echo STDOUT post-update
echo STDERR post-update >&2 echo STDERR post-update >&2
EOF EOF

View File

@ -52,7 +52,7 @@ super aquam refectionis educavit me;
animam meam convertit, animam meam convertit,
deduxit me super semitas jusitiae, deduxit me super semitas jusitiae,
EOF EOF
echo -n "propter nomen suum." >> new4.txt printf "propter nomen suum." >> new4.txt
cp new1.txt test.txt cp new1.txt test.txt
test_expect_success "merge without conflict" \ test_expect_success "merge without conflict" \