slitaz-base-files view rootfs/etc/profile @ rev 213

/etc/profile: add pushd/popd/dirs
author Pascal Bellard <pascal.bellard@slitaz.org>
date Tue Feb 19 16:42:10 2013 +0100 (2013-02-19)
parents ea47f7a7969e
children b4d39426898f
line source
1 # /etc/profile: System-wide .profile file for the Bourne shells
3 PATH="/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/sbin:/usr/local/bin"
4 LD_LIBRARY_PATH="/usr/lib:/lib:/usr/local/lib"
6 # Prompt format for Ash (Bash use /etc/bashrc).
7 if [ "`id -u`" -eq 0 ]; then
8 # Light green and blue colored prompt.
9 #PS1='\e[1;31m\u@\h\e[0m:\e[1;34m\w\e[0m\$ '
10 PS1='\u@\h:\w\$ '
11 else
12 # Light green and blue colored prompt.
13 #PS1="\[\e[1;32m\]\u@\h\[\e[0m\]:\[\e[1;34m\]\w\[\e[0m\]\$ "
14 PS1='\u@\h:\w\$ '
15 fi
17 # Max 64M for programs (prevent memory leak crashes)
18 ulimit -d 65536
19 ulimit -m 65536
21 # Screen display for X and encoding for GTK+ apps.
22 [ -n "$DISPLAY" ] || DISPLAY=:0.0
23 G_FILENAME_ENCODING=UTF-8
25 # Make OpenOffice look better.
26 OOO_FORCE_DESKTOP=gnome
28 # Export all variables defined above and set mask.
29 #
30 export PATH LD_LIBRARY_PATH PS1 DISPLAY G_FILENAME_ENCODING
31 export OOO_FORCE_DESKTOP ignoreeof
32 umask 022
34 # Locale and timezone settings.
35 #
36 if [ -s "/etc/locale.conf" ]; then
37 . /etc/locale.conf
38 export LANG LC_ALL
39 fi
40 if [ -s "/etc/TZ" ]; then
41 TZ=`cat /etc/TZ`
42 export TZ
43 fi
44 ip=$(ifconfig $(route -n|sed '$!d;s/.* //')|sed '/t a/!d;s/.*:\(.*\) B.*/\1/')
45 case "$TERM" in
46 xterm*|rxvt*) echo -ne "\033]0;$(hostname) $(cat /etc/slitaz-release) $ip\007";;
47 esac
49 dirs()
50 {
51 echo $_dirs
52 }
54 pushd()
55 {
56 cd $1 && _dirs="$1 $_dirs" && dirs
57 }
59 popd()
60 {
61 [ -n "$_dirs" ] && _dirs="${_dirs#* }" && cd ${_dirs%% *} && dirs
62 }