aboutsummaryrefslogtreecommitdiff
path: root/files/etc/profile
blob: 512e871653e2f11b3a414146cb0606778d0b98b8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
# /etc/profile: system-wide .profile file for the Bourne shell (sh(1))
# and Bourne compatible shells (bash(1), ksh(1), ash(1), ...).

if [ "`id -u`" -eq 0 ]; then
  PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
else
  PATH="/usr/local/bin:/usr/bin:/bin:/usr/games"
fi

function command_prompt() {
  exit_status="$?"
#  # colors
  COLOR_RED="\[\033[31m\]"
  COLOR_GREEN="\[\033[32;40m\]"
  COLOR_YELLOW="\[\033[33;40m\]"
  COLOR_BLUE="\[\033[34;40m\]"
  COLOR_MAGENTA="\[\033[35;40m\]"
  COLOR_CYAN="\[\033[36;40m\]"

  COLOR_RED_BOLD="\[\033[31;1m\]"
  COLOR_GREEN_BOLD="\[\033[32;1m\]"
  COLOR_YELLOW_BOLD="\[\033[33;1m\]"
  COLOR_BLUE_BOLD="\[\033[34;1m\]"
  COLOR_MAGENTA_BOLD="\[\033[35;1m\]"
  COLOR_CYAN_BOLD="\[\033[36;1m\]"

  COLOR_NONE="\[\033[0m\]"
  BOLD="\[\033[1m\]"

  if [ "$exit_status" == "0" ]; then
    status_color="${COLOR_GREEN}"
  else
    status_color="${COLOR_RED_BOLD}"
  fi

  PS1="\n${COLOR_RED}\D{%A - %d/%m/%Y - %H:%M:%S} - ${COLOR_YELLOW}Exit status: ${status_color}${exit_status}${COLOR_NONE}\n${COLOR_GREEN}\u@\h${COLOR_NONE}:${COLOR_CYAN}\w${COLOR_NONE} \$ "
  PS2="${BOLD}>${OFF} "
}

if [ "$PS1" ]; then
  if [ "$BASH" ]; then
    PS1='\u@\h:\w\$ '
    PROMPT_COMMAND=command_prompt
  else
    if [ "`id -u`" -eq 0 ]; then
      PS1='# '
    else
      PS1='$ '
    fi
  fi
fi

export PATH

umask 022