Skip to content

Commit

Permalink
Remove echo, Create _echo Function, Use printf
Browse files Browse the repository at this point in the history
  • Loading branch information
thcipriani committed Sep 23, 2013
1 parent 52a31c3 commit 200be3c
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions spark
Expand Up @@ -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=
Expand All @@ -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
Expand Down

0 comments on commit 200be3c

Please sign in to comment.