Skip to content

Commit

Permalink
Don't use "echo -n" in shell scripts
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
techee committed Feb 8, 2015
1 parent 47a5b9f commit ca21a87
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion m4/geany-status.m4
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ EOF
# Print a nice top bar
# description + ' : ' + value
total=`expr $dlen + 3 + $vlen`
for i in `seq 1 $total`; do echo -n '-'; done
for i in `seq 1 $total`; do printf '-'; done
echo
# And print the actual content
Expand Down
2 changes: 1 addition & 1 deletion po/intl_stats.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit ca21a87

Please sign in to comment.