From 5ee706b585a654dc0339201714dafb267cdcd6b7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Val=C3=A9rian=20Galliat?= Date: Wed, 26 Nov 2014 14:00:32 +0100 Subject: [PATCH] git-info: POSIX compliance Replace `echo -n` (non-POSIX) with an helper function `echon` echoing a newline after given expression. --- bin/git-info | 27 ++++++++++++++++----------- 1 file changed, 16 insertions(+), 11 deletions(-) diff --git a/bin/git-info b/bin/git-info index e9f862564..598a46ccc 100755 --- a/bin/git-info +++ b/bin/git-info @@ -20,23 +20,28 @@ remote_urls() { git remote -v } +echon() { + echo "$@" + echo +} + # Show info similar to svn echo -echo -e "## Remote URLs:\n" -echo -e "$(remote_urls)\n" +echon "## Remote URLs:" +echon "$(remote_urls)" -echo -e "## Remote Branches:\n" -echo -e "$(remote_branches)\n" +echon "## Remote Branches:" +echon "$(remote_branches)" -echo -e "## Local Branches:\n" -echo -e "$(local_branches)\n" +echon "## Local Branches:" +echon "$(local_branches)" -echo -e "## Most Recent Commit:\n" -echo -e "$(most_recent_commit)\n" -echo -e "Type 'git log' for more commits, or 'git show ' for full commit details.\n" +echon "## Most Recent Commit:" +echon "$(most_recent_commit)" +echon "Type 'git log' for more commits, or 'git show ' for full commit details." if test "$1" != "--no-config"; then - echo -e "## Configuration (.git/config):\n" - echo -e "$(get_config)\n" + echon "## Configuration (.git/config):" + echon "$(get_config)" fi