From 76d2b8802fc5c26cd4fce2b8ad1e657010f16ef3 Mon Sep 17 00:00:00 2001 From: drebs Date: Sat, 13 Feb 2010 10:45:32 -0200 Subject: Changing PS1 info from /etc/bash.bashrc to /etc/profile --- files/etc/profile | 55 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 55 insertions(+) create mode 100644 files/etc/profile (limited to 'files/etc/profile') diff --git a/files/etc/profile b/files/etc/profile new file mode 100644 index 0000000..512e871 --- /dev/null +++ b/files/etc/profile @@ -0,0 +1,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 -- cgit v1.2.3