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

add default man command in /etc/profile
author Pascal Bellard <pascal.bellard@slitaz.org>
date Wed Jul 16 09:49:08 2008 +0000 (2008-07-16)
parents d9469dd5238d
children 481a7361007f
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 # Screen display for X and encoding for GTK+ apps.
19 #
20 [ -n "$DISPLAY" ] || DISPLAY=:0.0
21 G_FILENAME_ENCODING=iso8859-1
23 # ldd fake
24 #
25 which ldd > /dev/null || alias ldd='/lib/ld*.so --list'
27 # man fake
28 #
29 if [ ! -x /usr/bin/man ]; then
31 man()
32 {
33 local i
34 local SECTION
35 local MSG
36 local TOPIC
37 local MAN_SECTION
38 case "$1" in
39 ''|-*)
40 cat <<EOT
41 Usage: man [section] command
42 EOT
43 return;;
44 esac
45 SECTION=all
46 MAN_SECTION='*'
47 MSG=""
48 if [ -n "$2" ]; then
49 SECTION=$1
50 MAN_SECTION=$1
51 MSG=" in section $SECTION"
52 shift
53 fi
54 TOPIC=$1
55 if [ -f /usr/share/doc/$TOPIC/$TOPIC.html ]; then
56 retawq --dump=file:///usr/share/doc/$TOPIC/$TOPIC.html | less -M
57 return
58 fi
59 for i in /usr/share/$LC_ALL/man$MAN_SECTION /usr/share/man$MAN_SECTION; do
60 if [ -f $i/$TOPIC.* ]; then
61 (zcat $i/$TOPIC.* || unlzma -c $i/$TOPIC.* 2>/dev/null)|less -M
62 return
63 fi
64 done
65 wget -O - "http://man.he.net/?topic=$TOPIC&section=$SECTION" 2> /dev/null | \
66 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\" }" | \
67 sed -e 's/<[^>]*>//g' -e 's/&lt;/</g' -e 's/&gt;/>/g' -e 's/&amp;/\&/g' | less -M
68 }
70 fi
73 # Export all variables definied above and set mask.
74 #
75 export PATH LD_LIBRARY_PATH PS1 DISPLAY G_FILENAME_ENCODING ignoreeof
76 umask 022
78 # Locale and timezone settings.
79 #
80 if [ -s "/etc/locale.conf" ]; then
81 . /etc/locale.conf
82 export LANG LC_ALL
83 fi
84 if [ -s "/etc/TZ" ]; then
85 TZ=`cat /etc/TZ`
86 export TZ
87 fi