Skip to content

Commit

Permalink
Clean up a few scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
pengwynn committed Jul 17, 2013
1 parent 64745be commit 7e529bb
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 12 deletions.
12 changes: 6 additions & 6 deletions bin/battery
@@ -1,4 +1,4 @@
#!/bin/sh
#!/bin/bash

# Author: Nicolas Goles
# url: https://github.com/Goles/Battery
Expand Down Expand Up @@ -28,7 +28,7 @@ battery_charge()
# Run Battery
#

BATTERY_STATUS=`battery_charge`
BATTERY_STATUS=$(battery_charge)
[ -z "$BATTERY_STATUS" ] && exit

#
Expand Down Expand Up @@ -107,23 +107,23 @@ fi
# Apply the correct color to the battery status prompt
#

if [ $BATTERY_STATUS -ge 75 ]; then
if [ "$BATTERY_STATUS" -ge 75 ]; then

# Green
case "$tmux" in
true) COLOR="#[fg=$good_color]" ;;
false) COLOR=$good_color ;;
esac

elif [ $BATTERY_STATUS -ge 25 ] && [ $BATTERY_STATUS -lt 75 ]; then
elif [ "$BATTERY_STATUS" -ge 25 ] && [ "$BATTERY_STATUS" -lt 75 ]; then

# Yellow
case "$tmux" in
true) COLOR="#[fg=$middle_color]" ;;
false) COLOR=$middle_color ;;
esac

elif [ $BATTERY_STATUS -lt 25 ]; then
elif [ "$BATTERY_STATUS" -lt 25 ]; then

# Red
case "$tmux" in
Expand All @@ -137,7 +137,7 @@ fi
# Print the battery status
#

GRAPH=$(spark 0 ${BATTERY_STATUS} 100 | awk '{print substr($0,4,3)}')
GRAPH=$(spark 0 "${BATTERY_STATUS}" 100 | awk '{print substr($0,4,3)}')

if [ "$tmux" == "false" ]; then
printf "\e[0;%sm%s %s \e[m\n" "$COLOR" "[$BATTERY_STATUS%]" "$GRAPH"
Expand Down
4 changes: 2 additions & 2 deletions bin/colordump
Expand Up @@ -8,11 +8,11 @@ i=0
row=0
while [ $i -lt 255 ];
do
newrow=$(expr $i / 10)
newrow=$((i / 10))
test $newrow -ne $row && printf "\n"
row=$newrow
printf "\e[%dm %03d \e[0m" $i $i
i=$(expr $i + 1)
i=$((i + 1))
done

printf '\n\n e.g., "\\e[41mTEXT\\e[0m" '
Expand Down
2 changes: 1 addition & 1 deletion bin/diffw
Expand Up @@ -2,5 +2,5 @@
wdiff -n \
-w $'\033[30;41m' -x $'\033[0m' \
-y $'\033[30;42m' -z $'\033[0m' \
$@
"$@"

6 changes: 3 additions & 3 deletions bin/e
Expand Up @@ -16,7 +16,7 @@

if test "$1" == ""
then
$($EDITOR .)
$EDITOR .
else
$($EDITOR $1)
fi
$EDITOR "$1"
fi

0 comments on commit 7e529bb

Please sign in to comment.