aboutsummaryrefslogtreecommitdiff
path: root/bash/bashrc.d
diff options
context:
space:
mode:
authorTom Ryder <tom@sanctum.geek.nz>2014-02-05 11:42:30 +1300
committerTom Ryder <tom@sanctum.geek.nz>2014-02-05 11:42:30 +1300
commit943e65e9d38b042863c59c34351cebe0085b70d4 (patch)
tree8414acb48f68b088793f6463736a7f83d17fb243 /bash/bashrc.d
parentReset three vars in one go (diff)
downloaddotfiles-943e65e9d38b042863c59c34351cebe0085b70d4.tar.gz
dotfiles-943e65e9d38b042863c59c34351cebe0085b70d4.zip
Declare vars as integers in prompt
Diffstat (limited to 'bash/bashrc.d')
-rw-r--r--bash/bashrc.d/prompt.bash13
1 files changed, 8 insertions, 5 deletions
diff --git a/bash/bashrc.d/prompt.bash b/bash/bashrc.d/prompt.bash
index 8e234fad..95ef4ab6 100644
--- a/bash/bashrc.d/prompt.bash
+++ b/bash/bashrc.d/prompt.bash
@@ -16,7 +16,7 @@ prompt() {
fi
# Count available colors, reset, and format (decided shortly)
- local colors=$( {
+ local -i colors=$( {
tput Co || tput colors
} 2>/dev/null );
local reset=$( {
@@ -73,7 +73,8 @@ prompt() {
branch=${branch##*/}
# Safely read status with -z --porcelain
- local line ready modified untracked
+ local line
+ local -i ready modified untracked
while IFS= read -d $'\0' -r line; do
if [[ $line == [MADRC]* ]]; then
ready=1
@@ -125,7 +126,8 @@ prompt() {
local -a state
# Safely read status with -0
- local line modified untracked
+ local line
+ local -i modified untracked
while IFS= read -d $'\0' -r line; do
if [[ $line == '?'* ]]; then
untracked=1
@@ -183,7 +185,8 @@ prompt() {
branch=${branch%%/*}
# Parse the output of svn status to determine working copy state
- local symbol modified untracked
+ local symbol
+ local -i modified untracked
while read -r symbol _; do
if [[ $symbol == *'?'* ]]; then
untracked=1
@@ -220,7 +223,7 @@ prompt() {
# Show the count of background jobs in curly brackets
job)
- local jobc=0
+ local -i jobc=0
while read -r _; do
((jobc++))
done < <(jobs -p)