slitaz-base-files rev 236

Update /etc/profile and use colored prompt
author Christophe Lincoln <pankso@slitaz.org>
date Wed Apr 16 23:49:39 2014 +0200 (2014-04-16)
parents 0a476090cd09
children 7d172a9f8000
files rootfs/etc/profile
line diff
     1.1 --- a/rootfs/etc/profile	Tue Apr 15 06:38:36 2014 +0200
     1.2 +++ b/rootfs/etc/profile	Wed Apr 16 23:49:39 2014 +0200
     1.3 @@ -4,59 +4,64 @@
     1.4  LD_LIBRARY_PATH="/usr/lib:/lib:/usr/local/lib"
     1.5  
     1.6  # Prompt format for Ash (Bash use /etc/bashrc).
     1.7 -if [ "`id -u`" -eq 0 ]; then
     1.8 -	# Light green and blue colored prompt.
     1.9 -	#PS1='\e[1;31m\u@\h\e[0m:\e[1;34m\w\e[0m\$ '
    1.10 -	PS1='\u@\h:\w\$ '
    1.11 +if [ $(id -u) -eq 0 ]; then
    1.12 +	# Red and blue for root
    1.13 +	PS1="\[\e[1;31m\]\u@\h\[\e[0m\]:\[\e[1;34m\]\w\[\e[0m\]\$ "
    1.14 +	#PS1='\u@\h:\w\$ '
    1.15  else
    1.16 -	# Light green and blue colored prompt.
    1.17 -	#PS1="\[\e[1;32m\]\u@\h\[\e[0m\]:\[\e[1;34m\]\w\[\e[0m\]\$ "
    1.18 -	PS1='\u@\h:\w\$ '
    1.19 +	# Green and blue for users
    1.20 +	PS1="\[\e[1;32m\]\u@\h\[\e[0m\]:\[\e[1;34m\]\w\[\e[0m\]\$ "
    1.21 +	#PS1='\u@\h:\w\$ '
    1.22  fi
    1.23  
    1.24  # Max 64M for programs (prevent memory leak crashes)
    1.25 +#
    1.26  ulimit -d 65536
    1.27  ulimit -m 65536
    1.28  
    1.29 -# Screen display for X and encoding for GTK+ apps.
    1.30 +# Screen display for X and encoding for GTK+ apps
    1.31 +#
    1.32  [ -n "$DISPLAY" ] || DISPLAY=:0.0
    1.33  G_FILENAME_ENCODING=UTF-8
    1.34  
    1.35 -# Make OpenOffice look better.
    1.36 +# Make OpenOffice look better
    1.37 +#
    1.38  OOO_FORCE_DESKTOP=gnome
    1.39  
    1.40 -# Export all variables defined above and set mask.
    1.41 +# Export all variables defined above and set mask
    1.42  #
    1.43  export PATH LD_LIBRARY_PATH PS1 DISPLAY G_FILENAME_ENCODING
    1.44  export OOO_FORCE_DESKTOP ignoreeof
    1.45  umask 022
    1.46  
    1.47 -# Locale and timezone settings.
    1.48 +# Locale and timezone settings
    1.49  #
    1.50  if [ -s "/etc/locale.conf" ]; then
    1.51  	. /etc/locale.conf
    1.52  	export LANG LC_ALL
    1.53  fi
    1.54  if [ -s "/etc/TZ" ]; then
    1.55 -	TZ=`cat /etc/TZ`
    1.56 +	TZ=$(cat /etc/TZ)
    1.57  	export TZ
    1.58  fi
    1.59 +
    1.60 +# Update X Terminal window title
    1.61 +#
    1.62  ip=$(ifconfig $(route -n|sed '$!d;s/.* //')|sed '/t a/!d;s/.*:\(.*\) B.*/\1/')
    1.63  case "$TERM" in
    1.64 -xterm*|rxvt*) echo -ne "\033]0;$(hostname) $(cat /etc/slitaz-release) $ip \007";;
    1.65 +	xterm*|rxvt*) echo -ne "\033]0;$(hostname) $(cat /etc/slitaz-release) $ip \007";;
    1.66  esac
    1.67  
    1.68 -dirs()
    1.69 -{
    1.70 +# Bash compatibility
    1.71 +
    1.72 +dirs() {
    1.73  	echo $_dirs
    1.74  }
    1.75  
    1.76 -pushd()
    1.77 -{
    1.78 +pushd() {
    1.79  	cd $1 && _dirs="$1 $_dirs" && dirs
    1.80  }
    1.81  
    1.82 -popd()
    1.83 -{
    1.84 +popd() {
    1.85  	[ -n "$_dirs" ] && _dirs="${_dirs#* }" && cd ${_dirs%% *} && dirs
    1.86  }