Permalink
Browse files

Remove echo, Create _echo Function, Use printf

  • Loading branch information...
1 parent 52a31c3 commit 200be3c22175b476a1305194441cdc69e7c89778 @thcipriani thcipriani committed Sep 23, 2013
Showing with 12 additions and 2 deletions.
  1. +12 −2 spark
View
14 spark
@@ -27,6 +27,16 @@
# Generates sparklines.
#
# $1 - The data we'd like to graph.
+_echo()
+{
+ if [ "X$1" = "X-n" ]; then
+ shift
+ printf "%s" "$*"
+ else
+ printf "%s\n" "$*"
+ fi
+}
+
spark()
{
local n numbers=
@@ -53,9 +63,9 @@ spark()
for n in $numbers
do
- echo -n ${ticks[$(( ((($n-$min)<<8)/$f) ))]}
+ _echo -n ${ticks[$(( ((($n-$min)<<8)/$f) ))]}
done
- echo
+ _echo
}
# If we're being sourced, don't worry about such things

0 comments on commit 200be3c

Please sign in to comment.