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

/etc/profile: fix prompt for bash
author Pascal Bellard <pascal.bellard@slitaz.org>
date Tue Sep 02 08:12:02 2008 +0000 (2008-09-02)
parents 08b3ad2c859b
children 7d8b7107b713
line source
1 # /etc/profile: system-wide .profile file for the Bourne shells
3 PATH="/usr/sbin:/usr/bin:/sbin:/bin:/usr/games"
4 LD_LIBRARY_PATH="/usr/lib:/lib"
6 # Prompt format for Ash (Bash use /etc/bashrc).
7 #
8 if [ "`id -u`" -eq 0 ]; then
9 # Light green and blue colored prompt.
10 #PS1='\e[1;31m\u@\h\e[0m:\e[1;34m\w\e[0m\$ '
11 PS1='\u@\h:\w\$ '
12 else
13 # Light green and blue colored prompt.
14 PS1='\e[1;32m\u@\h\e[0m:\e[1;34m\w\e[0m\$ '
15 #PS1='\u@\h:\w\$ '
16 fi
18 # Max 64M for programs (prevent memory leak crashs)
19 ulimit -d 65536
20 ulimit -s 65536
21 ulimit -m 65536
22 ulimit -v 524288
23 # Screen display for X and encoding for GTK+ apps.
24 #
25 [ -n "$DISPLAY" ] || DISPLAY=:0.0
26 G_FILENAME_ENCODING=iso8859-1
28 # ldd fake
29 #
30 which ldd > /dev/null || alias ldd='/lib/ld*.so --list'
32 # man fake
33 #
34 if [ ! -x /usr/bin/man ]; then
36 man()
37 {
38 local i
39 local SECTION
40 local MSG
41 local TOPIC
42 local MAN_SECTION
43 case "$1" in
44 ''|-*)
45 cat <<EOT
46 Usage: man [section] command
47 EOT
48 return;;
49 esac
50 SECTION=all
51 MAN_SECTION='*'
52 MSG=""
53 if [ -n "$2" ]; then
54 SECTION=$1
55 MAN_SECTION=$1
56 MSG=" in section $SECTION"
57 shift
58 fi
59 TOPIC=$1
60 if [ -x /usr/bin/retawq -a -f /usr/share/doc/$TOPIC/$TOPIC.html ]; then
61 retawq --dump=file:///usr/share/doc/$TOPIC/$TOPIC.html | less -M
62 return
63 fi
64 for i in /usr/share/$LC_ALL/man$MAN_SECTION /usr/share/man$MAN_SECTION; do
65 if [ -f $i/raw-$TOPIC.* ]; then
66 i=$(ls $i/raw-$TOPIC.*)
67 case "$i" in
68 *gz) (zcat $i || unlzma -c $i 2> /dev/null) | less -M;;
69 *) less -M $i;;
70 esac
71 return
72 fi
73 if [ -x /usr/bin/retawq -a -f $i/$TOPIC.html ]; then
74 retawq --dump=file://$i/$TOPIC.html | less -M
75 return
76 fi
77 done
78 (wget -O - "http://mirror.slitaz.org/man/$SECTION/$TOPIC.html" || \
79 wget -O - "http://man.he.net/?topic=$TOPIC&section=$SECTION") 2> /dev/null | \
80 awk "BEGIN { s=0; n=0 } /<PRE>/ { s=1 } { if (s) { print; n++} } /<\/PRE>/ { s=0 } END { if (n == 0) print \"No manual entry for $TOPIC$MSG\" }" | \
81 sed -e 's/<[^>]*>//g' -e 's/&lt;/</g' -e 's/&gt;/>/g' -e 's/&amp;/\&/g' | less -M
82 }
84 fi
87 # Export all variables defined above and set mask.
88 #
89 export PATH LD_LIBRARY_PATH PS1 DISPLAY G_FILENAME_ENCODING ignoreeof
90 umask 022
92 # Locale and timezone settings.
93 #
94 if [ -s "/etc/locale.conf" ]; then
95 . /etc/locale.conf
96 export LANG LC_ALL
97 fi
98 if [ -s "/etc/TZ" ]; then
99 TZ=`cat /etc/TZ`
100 export TZ
101 fi