fix ansi escape characters and quoting

This commit is contained in:
James Dixon 2020-05-12 02:11:20 -04:00
parent 7d7c8a3b61
commit 3764099eb1
2 changed files with 26 additions and 26 deletions

View File

@ -1,4 +1,4 @@
[[ -f "$HOME/.bashrc" ]] && source "$HOME/.bashrc" [ -f "$HOME/.bashrc" ] && source "$HOME/.bashrc"
appendpath () { appendpath () {
case ":$PATH:" in case ":$PATH:" in
@ -15,8 +15,8 @@ user_paths=("$HOME/bin" "$HOME/.local/bin" "$HOME/scripts" "$HOME/.local/scripts
user_paths+=("$HOME/.cargo/bin" "$HOME/go/bin" "$HOME/.local/go/bin") user_paths+=("$HOME/.cargo/bin" "$HOME/go/bin" "$HOME/.local/go/bin")
for path in "${user_paths[@]}"; do for path in "${user_paths[@]}"; do
if [ -d $path ]; then if [ -d "$path" ]; then
appendpath $path appendpath "$path"
fi fi
done done

View File

@ -117,14 +117,14 @@ parse_git() {
printf ":(${BRANCH})[" printf ":(${BRANCH})["
fi fi
if echo ${STATUS} | grep -c "nothing to commit" &> /dev/null; then printf "\033[1;34m=\033[0m"; else printf ""; fi if echo "${STATUS}" | grep -c "nothing to commit" &> /dev/null; then printf "\033[1;34m=\033[0m"; else printf ""; fi
if echo ${STATUS} | grep -c "renamed:" &> /dev/null; then printf "\033[1;31m>\033[0m"; else printf ""; fi if echo "${STATUS}" | grep -c "renamed:" &> /dev/null; then printf "\033[1;31m>\033[0m"; else printf ""; fi
if echo ${STATUS} | grep -c "deleted:" &> /dev/null; then printf "\033[1;31m-\033[0m"; else printf ""; fi if echo "${STATUS}" | grep -c "deleted:" &> /dev/null; then printf "\033[1;31m-\033[0m"; else printf ""; fi
if echo ${STATUS} | grep -c "new file:" &> /dev/null; then printf "\033[1;32m+\033[0m"; else printf ""; fi if echo "${STATUS}" | grep -c "new file:" &> /dev/null; then printf "\033[1;32m+\033[0m"; else printf ""; fi
if echo ${STATUS} | grep -c "branch is ahead:" &> /dev/null; then printf "\033[1;33m!\033[0m"; else printf ""; fi if echo "${STATUS}" | grep -c "branch is ahead:" &> /dev/null; then printf "\033[1;33m!\033[0m"; else printf ""; fi
if echo ${STATUS} | grep -c "Untracked files:" &> /dev/null; then printf "\033[1;33m?\033[0m"; else printf ""; fi if echo "${STATUS}" | grep -c "Untracked files:" &> /dev/null; then printf "\033[1;33m?\033[0m"; else printf ""; fi
if echo ${STATUS} | grep -c "modified:" &> /dev/null; then printf "\033[1;33m*\033[0m"; else printf ""; fi if echo "${STATUS}" | grep -c "modified:" &> /dev/null; then printf "\033[1;33m*\033[0m"; else printf ""; fi
printf "]" printf "]"
} }
@ -156,7 +156,7 @@ pathappend() {
# https://superuser.com/questions/39751/add-directory-to-path-if-its-not-already-there # https://superuser.com/questions/39751/add-directory-to-path-if-its-not-already-there
for ARG; do for ARG; do
if [ -d "$ARG" ] && [[ ":$PATH:" != *":$ARG:"* ]]; then if [ -d "$ARG" ] && [[ ":$PATH:" != *":$ARG:"* ]]; then
ABS_DIR="$(readlink -f $ARG)" ABS_DIR="$(readlink -f "$ARG")"
PATH="${PATH:+"$PATH:"}$ABS_DIR" PATH="${PATH:+"$PATH:"}$ABS_DIR"
echo "$ABS_DIR" added! echo "$ABS_DIR" added!
else else
@ -174,12 +174,12 @@ bkup() {
#========== PROMPTS ==========# #========== PROMPTS ==========#
# git prompts # git prompts
PS1="\033[1;34m\w\033[0m\$(parse_git) \033[1;35m\$\033[0m " # PS1="\[\033[1;34m\]\w\[\033[0m\]\$(parse_git) \[\033[1;35m\]\$\[\033[0m\] "
# PS1="\033[1;35m\u\033[1;33m@\033[1;36m\h\033[0m:\033[1;37:\033[1;34m\w\033[0m\$(parse_git)\033[0m\033[1;33m$ \033[0m" PS1="\[\033[1;35m\]\u\[\033[1;33m\]@\[\033[1;36m\]\h\[\033[0m\]:\[\033[1;37:\[\033[1;34m\]\w\[\033[0m\]\$(parse_git)\[\033[0m\]\[\033[1;33m\]$ \[\033[0m\]"
# non git prompts # non git prom\]pts
# PS1="\033[1;34m\w \033[1;33m\$ \033[0m" # PS1="\[\033[1;34m\]\w \[\033[1;33m\]\$ \[\033[0m\]"
# PS1="\033[1;35m\u\033[1;33m@\033[1;36m\h\033[0m:\033[1;37:\033[1;34m\w\033[0m\033[1;33m$ \033[0m" # PS1="\[\033[1;35m\]\u\[\033[1;33m\]@\[\033[1;36m\]\h\[\033[0m\]:\[\033[1;37:\[\033[1;34m\]\w\[\033[0m\]\[\033[1;33m\]$ \[\033[0m\]"
# non color prompts # non color prompts
# PS1="\w \$ " # PS1="\w \$ "
@ -199,15 +199,15 @@ fi
# COLORS according to (ANSI/VT100 Control sequences) # COLORS according to (ANSI/VT100 Control sequences)
# https://misc.flogisoft.com/bash/tip_colors_and_formatting for examples # https://misc.flogisoft.com/bash/tip_colors_and_formatting for examples
# \033[0;30m BLACK \033[1;30m DARK GREY # \[\033[0;30m\] BLACK \[\033[1;30m\] DARK GREY
# \033[0;31m RED \033[1;31m LIGHT RED # \[\033[0;31m\] RED \[\033[1;31m\] LIGHT RED
# \033[0;32m GREEN \033[1;32m LIGHT GREEN # \[\033[0;32m\] GREEN \[\033[1;32m\] LIGHT GREEN
# \033[0;33m BROWN \033[1;33m YELLOW # \[\033[0;33m\] BROWN \[\033[1;33m\] YELLOW
# \033[0;34m BLUE \033[1;34m LIGHT BLUE # \[\033[0;34m\] BLUE \[\033[1;34m\] LIGHT BLUE
# \033[0;35m PURPLE \033[1;35m LIGHT PURPLE # \[\033[0;35m\] PURPLE \[\033[1;35m\] LIGHT PURPLE
# \033[0;36m CYAN \033[1;36m LIGHT CYAN # \[\033[0;36m\] CYAN \[\033[1;36m\] LIGHT CYAN
# \033[0;37m LIGHT GREY \033[1;37m WHITE # \[\033[0;37m\] LIGHT GREY \[\033[1;37m\] WHITE
# \033[0m RESET NORMAL # \[\033[0m\] RESET NORMAL
# \033[1m RESET BOLD # \[\033[1m\] RESET BOLD