wip/fixes
This commit is contained in:
parent
4cc5b8a502
commit
62a33a5583
1 changed files with 20 additions and 19 deletions
|
@ -1,29 +1,30 @@
|
||||||
[ "$(cat /proc/$$/comm)" = "bash" ] || return
|
SH="$(cat /proc/$$/comm)"
|
||||||
|
|
||||||
# completion
|
case "${SH}" in
|
||||||
|
"bash")
|
||||||
file="/usr/share/bash-completion/bash_completion"
|
# completion
|
||||||
|
file="/usr/share/bash-completion/bash_completion"
|
||||||
if [ -f "${file}" ]; then
|
if [ -f "${file}" ]; then
|
||||||
. "${file}"
|
. "${file}"
|
||||||
fi
|
fi
|
||||||
|
# history
|
||||||
# history
|
HISTCONTROL="ignorespace"
|
||||||
|
HISTSIZE=-1
|
||||||
HISTCONTROL="ignorespace"
|
HISTTIMEFORMAT="%Y%m%d %H%M%S "
|
||||||
|
;;
|
||||||
HISTSIZE=-1
|
*)
|
||||||
|
;;
|
||||||
HISTTIMEFORMAT="%Y%m%d %H%M%S "
|
esac
|
||||||
|
|
||||||
# prompt
|
# prompt
|
||||||
|
|
||||||
ps1() {
|
ps1() {
|
||||||
local date host
|
local date host id
|
||||||
local code="${1}"
|
local code="${1}"
|
||||||
date="$(date +%H:%M:%S)"
|
date="$(date +%H:%M:%S)"
|
||||||
local git
|
local git
|
||||||
host="$(hostname)"
|
host="$(hostname)"
|
||||||
|
id="$(id --user)"
|
||||||
local path="${PWD}"
|
local path="${PWD}"
|
||||||
local user="${USER}"
|
local user="${USER}"
|
||||||
local view="└ "
|
local view="└ "
|
||||||
|
@ -33,7 +34,7 @@ ps1() {
|
||||||
view="${view}\e[0;32m"
|
view="${view}\e[0;32m"
|
||||||
fi
|
fi
|
||||||
view="${view}${code}\e[0m @ \e[0;33m${date}\e[0m"
|
view="${view}${code}\e[0m @ \e[0;33m${date}\e[0m"
|
||||||
if [ "$(type -t __git_ps1)" == "function" ]; then
|
if [ "$(type -t __git_ps1)" = "function" ]; then
|
||||||
git="$(__git_ps1)"
|
git="$(__git_ps1)"
|
||||||
if [ -n "${git}" ]; then
|
if [ -n "${git}" ]; then
|
||||||
view="${view} –\e[0;35m${git}\e[0m"
|
view="${view} –\e[0;35m${git}\e[0m"
|
||||||
|
@ -41,7 +42,7 @@ ps1() {
|
||||||
fi
|
fi
|
||||||
view="${view}\n\e[0;36m${path}\e[0m"
|
view="${view}\n\e[0;36m${path}\e[0m"
|
||||||
view="${view}\n┌ "
|
view="${view}\n┌ "
|
||||||
if [ ${EUID} -eq 0 ]; then
|
if [ "${id}" -eq 0 ]; then
|
||||||
view="${view}\e[0;31m"
|
view="${view}\e[0;31m"
|
||||||
else
|
else
|
||||||
view="${view}\e[0;32m"
|
view="${view}\e[0;32m"
|
||||||
|
|
Loading…
Reference in a new issue