updated bash prompt to show if I have permissions for the folder I'm in
This commit is contained in:
parent
009c7c50e1
commit
b428d48fb3
@ -23,7 +23,7 @@ shopt -s checkwinsize
|
|||||||
[ -x /usr/bin/lesspipe ] && eval "$(SHELL=/bin/sh lesspipe)"
|
[ -x /usr/bin/lesspipe ] && eval "$(SHELL=/bin/sh lesspipe)"
|
||||||
|
|
||||||
# colored GCC warnings and errors
|
# colored GCC warnings and errors
|
||||||
#export GCC_COLORS='error=01;31:warning=01;35:note=01;36:caret=01;32:locus=01:quote=01'
|
export GCC_COLORS='error=01;31:warning=01;35:note=01;36:caret=01;32:locus=01:quote=01'
|
||||||
|
|
||||||
# some more ls aliases
|
# some more ls aliases
|
||||||
alias lsa='ls -lah'
|
alias lsa='ls -lah'
|
||||||
@ -59,7 +59,15 @@ set_exit_code() {
|
|||||||
set_prompt() {
|
set_prompt() {
|
||||||
PS1_BAT="$(bash-status-bat)"
|
PS1_BAT="$(bash-status-bat)"
|
||||||
PS1_GIT="$(bash-status-git)"
|
PS1_GIT="$(bash-status-git)"
|
||||||
PS1L="\[\033[00;32m\]\u\[\033[00;34m\]@\[\033[01;32m\]\h \[\033[00m\]\$PS1_BAT \[\033[00;36m\]\w\[\033[00m\] $PS1_GIT"
|
|
||||||
|
dir_perm=$(ls -ld | awk '{ print $3 }')
|
||||||
|
if [[ "$dir_perm" == "$USER" ]]; then
|
||||||
|
dir="\[\033[00;36m\]\w"
|
||||||
|
else
|
||||||
|
dir="\[\033[00;31m\]\w"
|
||||||
|
fi
|
||||||
|
|
||||||
|
PS1L="\[\033[00;32m\]\u\[\033[00;34m\]@\[\033[01;32m\]\h \[\033[00m\]\$PS1_BAT $dir\[\033[00m\] $PS1_GIT"
|
||||||
PS1R=$(date +"%R:%S")
|
PS1R=$(date +"%R:%S")
|
||||||
PS1=$(printf "%*s\r%s\n\[\033[00m\]\$(set_exit_code)-[ " "$(tput cols)" "$PS1R" "$PS1L")
|
PS1=$(printf "%*s\r%s\n\[\033[00m\]\$(set_exit_code)-[ " "$(tput cols)" "$PS1R" "$PS1L")
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user