[geany/geany-plugins] e9cb0f: Don't use "echo -n" in shell scripts

Jiří Techet git-noreply at xxxxx
Fri Feb 13 11:34:05 UTC 2015


Branch:      refs/heads/master
Author:      Jiří Techet <techet at gmail.com>
Committer:   Jiří Techet <techet at gmail.com>
Date:        Fri, 13 Feb 2015 11:34:05 UTC
Commit:      e9cb0f9ed07bae1f52fbc0893023542ba01eb6fc
             https://github.com/geany/geany-plugins/commit/e9cb0f9ed07bae1f52fbc0893023542ba01eb6fc

Log Message:
-----------
Don't use "echo -n" in shell scripts

The standard says:

If the first operand is -n, or if any of the operands contain a
backslash ( '\' ) character, the results are implementation-defined.

On OS X it simply prints the "-n" string and everything which follows,
including the newline.

Use printf instead.


Modified Paths:
--------------
    build/status.m4
    po/intl_stats.sh

Modified: build/status.m4
4 lines changed, 2 insertions(+), 2 deletions(-)
===================================================================
@@ -28,9 +28,9 @@ AC_DEFUN([_GP_STATUS_PRINT_INDENT_],
         plugin="    ${line%:*}:"
         status=${line#*:}
         let extracols=$2-${#plugin}
-        echo -n "$plugin"
+        printf "$plugin"
         for (( i=0; $i<$extracols; i++ )); do
-            echo -n ' '
+            printf ' '
         done
         echo $status
     done << GPEOF


Modified: po/intl_stats.sh
2 lines changed, 1 insertions(+), 1 deletions(-)
===================================================================
@@ -92,7 +92,7 @@ else
    do
      # maybe the regexp can be optimized, regexps are not my best friends
      creationdate=`grep "PO-Revision-Date:" po/$lang.po | sed 's/.*: \([0-9]\{4\}-[0-9]\{2\}-[0-9]\{2\} [0-9]\{2\}:[0-9]\{2\}[+|-][0-9]\{4\}\).*/\1/'`
-     echo -n $eswitch $lang"\t("$creationdate"):\t"
+     printf "%s %s\t(%s):\t" "$eswitch" "$lang" "$creationdate"
      msgfmt --check --statistics po/$lang.po;
    done
 fi



--------------
This E-Mail was brought to you by github_commit_mail.py (Source: https://github.com/geany/infrastructure).


More information about the Plugins-Commits mailing list