Permalink
Browse files

Characters ( and ) creates subshell and then executes the list of com…

…mands, { is smarter and faster.

When using -z you need "" or you will be evaluating the ']' character if $1 is unset.
  • Loading branch information...
1 parent 5eabc56 commit d28881a9bfdbc67fd46223f5c4ab74a57e94bb29 Arturo Borrero Gonzalez committed Sep 11, 2012
Showing with 2 additions and 1 deletion.
  1. +2 −1 spark
View
3 spark
@@ -65,6 +65,7 @@ spark()
# print ticks
local ticks=(▁ ▂ ▃ ▄ ▅ ▆ ▇ █)
+ # this is fine, but normal people don't understand it -_-
local f=$(( (($max-$min)<<8)/(${#ticks[@]}-1) ))
(( f < 1 )) && f=1
@@ -79,7 +80,7 @@ spark()
[[ ${#BASH_SOURCE[@]} -eq 1 ]] || return
# show help for no arguments if stdin is a terminal
-if ([ -z $1 ] && [ -t 0 ]) || [ "$1" == '-h' ]
+if { [ -z "$1" ] && [ -t 0 ] ; } || [ "$1" == '-h' ]
then
help
exit

0 comments on commit d28881a

Please sign in to comment.