@matheusbsbs / matheus-bagliano / commits / 2aad957a51
Fork 0

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>

Jason Riedy committed Jan 15, 2007 at 17:31 UTC 2aad957a519b354e248da8c76ee0d3997083dde6
6 files changed +7 -7
contrib/remotes2config.sh
+1 -1
@@ -11,7 +11,7 @@ if [ -d "$GIT_DIR"/remotes ]; then
11 {
12 cd "$GIT_DIR"/remotes
13 ls | while read f; do
14 - name=$(echo -n "$f" | tr -c "A-Za-z0-9" ".")
14 + name=$(printf "$f" | tr -c "A-Za-z0-9" ".")
15 sed -n \
16 -e "s/^URL: \(.*\)$/remote.$name.url \1 ./p" \
17 -e "s/^Pull: \(.*\)$/remote.$name.fetch \1 ^$ /p" \
git-quiltimport.sh
+1 -1
@@ -89,7 +89,7 @@ for patch_name in $(cat "$QUILT_PATCHES/series" | grep -v '^#'); do
89 echo "No author found in $patch_name" >&2;
90 echo "---"
91 cat $tmp_msg
92 - echo -n "Author: ";
92 + printf "Author: ";
93 read patch_author
94
95 echo "$patch_author"
git-reset.sh
+1 -1
@@ -87,7 +87,7 @@ update_ref_status=$?
87 case "$reset_type" in
88 --hard )
89 test $update_ref_status = 0 && {
90 - echo -n "HEAD is now at "
90 + printf "HEAD is now at "
91 GIT_PAGER= git log --max-count=1 --pretty=oneline \
92 --abbrev-commit HEAD
93 }
t/t3800-mktag.sh
+1 -1
@@ -88,7 +88,7 @@ check_verify_failure '"type" line label check'
88 # 5. type line eol check
89
90 echo "object 779e9b33986b1c2670fff52c5067603117b3e895" >tag.sig
91 -echo -n "type tagsssssssssssssssssssssssssssssss" >>tag.sig
91 +printf "type tagsssssssssssssssssssssssssssssss" >>tag.sig
92
93 cat >expect.pat <<EOF
94 ^error: char48: .*"[\]n"$
t/t5401-update-hooks.sh
+2 -2
@@ -23,7 +23,7 @@ test_expect_success setup '
23 cat >victim/.git/hooks/update <<'EOF'
24 #!/bin/sh
25 echo "$@" >$GIT_DIR/update.args
26 -read x; echo -n "$x" >$GIT_DIR/update.stdin
26 +read x; printf "$x" >$GIT_DIR/update.stdin
27 echo STDOUT update
28 echo STDERR update >&2
29 EOF
@@ -32,7 +32,7 @@ chmod u+x victim/.git/hooks/update
32 cat >victim/.git/hooks/post-update <<'EOF'
33 #!/bin/sh
34 echo "$@" >$GIT_DIR/post-update.args
35 -read x; echo -n "$x" >$GIT_DIR/post-update.stdin
35 +read x; printf "$x" >$GIT_DIR/post-update.stdin
36 echo STDOUT post-update
37 echo STDERR post-update >&2
38 EOF
t/t6023-merge-file.sh
+1 -1
@@ -52,7 +52,7 @@ super aquam refectionis educavit me;
52 animam meam convertit,
53 deduxit me super semitas jusitiae,
54 EOF
55 -echo -n "propter nomen suum." >> new4.txt
55 +printf "propter nomen suum." >> new4.txt
56
57 cp new1.txt test.txt
58 test_expect_success "merge without conflict" \