Use BASH instead of tr(1) & wc(1)
Most of the time, people use programs like tr(1) and wc(1) when they're woefully unnecessary, serving only to make their programs inefficient and bloated. BASH itself can deal with most of these tasks with absolute ease. This is one such situation.pull/1840/head
parent
f4299f437c
commit
4fd66d4751
|
|
@ -248,7 +248,9 @@ function git_prompt_vars {
|
|||
if [[ "${SCM_GIT_GITSTATUS_RAN}" == "true" ]]; then
|
||||
stash_count=${VCS_STATUS_STASHES}
|
||||
else
|
||||
stash_count="$(git stash list 2> /dev/null | wc -l | tr -d ' ')"
|
||||
local Data
|
||||
readarray Data <<< "$(git stash list 2> /dev/null)"
|
||||
stash_count=${Data//[![:digit:]]/}
|
||||
fi
|
||||
[[ "${stash_count}" -gt 0 ]] && SCM_BRANCH+=" ${SCM_GIT_STASH_CHAR_PREFIX}${stash_count}${SCM_GIT_STASH_CHAR_SUFFIX}"
|
||||
fi
|
||||
|
|
|
|||
Loading…
Reference in New Issue