40 lines
663 B
Bash
40 lines
663 B
Bash
#!/bin/bash
|
|
|
|
# Prompt
|
|
|
|
FQDN=$(hostname --fqdn)
|
|
|
|
if [[ $FQDN == *.verdnatura.es ]]; then
|
|
SHORT_HOST=${FQDN%.verdnatura.es}
|
|
|
|
case "$SHORT_HOST" in
|
|
*.dc)
|
|
ENVIRONMENT="\[\033[01;31m\]PRO\[\033[00m\]"
|
|
;;
|
|
*.lab)
|
|
ENVIRONMENT="\[\033[01;35m\]LAB\[\033[00m\]"
|
|
;;
|
|
*)
|
|
ENVIRONMENT="\[\033[01;32m\]VN\[\033[00m\]"
|
|
;;
|
|
esac
|
|
|
|
PS1="\u@$SHORT_HOST[$ENVIRONMENT]:\w"
|
|
|
|
if [ "$(id -u)" -eq 0 ]; then
|
|
PS1="$PS1# "
|
|
else
|
|
PS1="$PS1\$ "
|
|
fi
|
|
fi
|
|
|
|
# History
|
|
|
|
HISTSIZE=10000
|
|
HISTFILESIZE=50000
|
|
HISTTIMEFORMAT="%Y-%m-%d %H:%M:%S "
|
|
|
|
# Security
|
|
|
|
TMOUT=3600
|