1
0
Fork 0

cleanup, fix bug with prompt

This commit is contained in:
Massaki Archambault 2018-10-31 14:23:30 -04:00
parent f027767fca
commit bdfa31f9d5
4 changed files with 4 additions and 35 deletions

View File

@ -1,24 +1,6 @@
# make word splitting behave like bash
setopt SH_WORD_SPLIT
# Evaluate if root user
if uname -s | egrep -q '^(CYGWIN)|(MINGW)|(MSYS)'; then
#windows
if id -G | grep -q 544; then
IS_ROOT=true
else
IS_ROOT=false
fi
else
#'nix
if [[ $UID -eq 0 ]]; then
IS_ROOT=true
else
IS_ROOT=false
fi
fi
export IS_ROOT
# gpg-agent
export GPG_TTY=$(tty)
gpg-connect-agent updatestartuptty /bye >/dev/null

View File

@ -1,4 +1,2 @@
if [ "$IS_ROOT" = false ]; then
motd
fi
motd

View File

@ -1,13 +0,0 @@
ascii_distro="arch_small"
print_info () {
info line_break
info "OS" distro
info "Shell" shell
info "Kernel" kernel
info line_break
info "Packages" packages "$update_msg"
}

View File

@ -61,7 +61,9 @@ prompt_cmd() {
local wd_base="${PWD/$HOME/~}"
local wd_post=$(echo "$wd_base" | grep -Eo '(^~|/[^/]+){1,4}$')
local wd_pre=$(echo "${wd_base/$wd_post/}" | grep -Eo '^~|/[^/]{2}' | tr -d '\n' )
local wd="%{$fg[yellow]%}$wd_pre$wd_post"
local wd="$wd_pre$wd_post"
[[ "$wd" == "" ]] && wd="/"
wd="%{$fg[yellow]%}$wd"
# prompt
if __is_root; then