Chinaunix

标题: /etc/profile的疑问? [打印本页]

作者: billquick    时间: 2004-11-28 22:06
标题: /etc/profile的疑问?
tHIS is /etc/profile content for solaris9 X86
看看红色的是什么意思?谢谢

#ident        "@(#)profile        1.19        01/03/13 SMI"        /* SVr4.0 1.3        */

# The profile that all logins get before using their own .profile.

trap ""  2 3
export LOGNAME PATH

if [ "$TERM" = "" ]
then
        if /bin/i386
        then
                TERM=sun-color
        else
                TERM=sun
        fi
        export TERM
fi

#        Login and -su shells get /etc/profile services.
#        -rsh is given its environment in its .profile.

case "$0" in
-sh | -ksh | -jsh | -bash)

        if [ ! -f .hushlogin ]
        then
                /usr/sbin/quota
                #        Allow the user to break the Message-Of-The-Day only.
                trap "trap '' 2"  2
                /bin/cat -s /etc/motd
                trap "" 2

                /bin/mail -E
                case $? in
                0)
                        echo "You have new mail."
                          ;;
                2)
                        echo "You have mail."
                           ;;
                esac
        fi
esac

umask 022
trap  2 3
作者: 小鹭    时间: 2004-11-29 09:35
标题: /etc/profile的疑问?
哪个红色?
作者: billquick    时间: 2004-11-29 19:54
标题: /etc/profile的疑问?
trap "trap '' 2" 2
/bin/cat -s /etc/motd

作者: 寂寞烈火    时间: 2004-11-29 22:06
标题: /etc/profile的疑问?
trap "trap '' 2" 2
#当shell接受到信号2(一般情况下是ctrl+C)时,执行trap '' 2,即忽略ctrl+C所产生的中断
/bin/cat -s /etc/motd
#显示/etc/motd的内容,motd文件存放的是当天的一些讯息
关于trap,他的作用是当shell接受到某一个信号,就执行特定的操作!信号列表,可以用:
kill -l来获得
作者: billquick    时间: 2004-11-29 22:11
标题: /etc/profile的疑问?
原帖由 "寂寞烈火" 发表:
trap "trap '' 2" 2
#当shell接受到信号2(一般情况下是ctrl+C)时,执行trap '' 2,即忽略ctrl+C所产生的中断



trap "trap '' 2" 2   等于 trap '' 2  

Right ??
作者: 寂寞烈火    时间: 2004-11-29 22:38
标题: /etc/profile的疑问?
看一下你系统的shell的manual,里面有trap的解释!
作者: wingger    时间: 2004-12-05 17:49
标题: /etc/profile的疑问?
借问一下:我怎么找不到这些内容呢
作者: 寂寞烈火    时间: 2004-12-05 17:58
标题: /etc/profile的疑问?
[quote]原帖由 "wingger"]借问一下:我怎么找不到这些内容呢[/quote 发表:


作者: wingger    时间: 2004-12-05 18:00
标题: /etc/profile的疑问?
/bin/mail -E
case $? in
0)
echo "You have new mail."
;;
2)
echo "You have mail."
;;
esac
fi
esac

umask 022
trap 2 3

我是说profile没有这些内容
作者: 寂寞烈火    时间: 2004-12-05 18:04
标题: /etc/profile的疑问?
原帖由 "wingger" 发表:
/bin/mail -E
case $? in
0)
echo "You have new mail."
;;
2)
echo "You have mail."
;;
esac
fi
esac

umask 022
trap 2 3

我是说profile没有这些内容

是系统不一样吧,我也没有这些内容!
作者: wingger    时间: 2004-12-05 18:28
标题: /etc/profile的疑问?
那我们的环境变量在哪设?
作者: 網中人    时间: 2004-12-05 20:15
标题: /etc/profile的疑问?
[quote]原帖由 "wingger"]那我们的环境变量在哪设?[/quote 发表:

環境變量從 init 開始執行 rc.sysinit 及 rc script 開始就會設了.
及後, man bash, 看 INVOCATION 那一節, 再挖一下裡面提到的 script 就知道了.
尤其是那些被 source 進來的!
作者: wingger    时间: 2004-12-05 20:44
标题: /etc/profile的疑问?
谢谢网中人

四种?
interactive  shell分两个:
login shell:/etc/profile-->~/.bash_profile等
not a login shell :~/.bashrc
non-interactive shell:BASH_ENV
name sh?
posix

MAN里说的是满清楚的,不过俺的英文水平有限,还是不太理解




欢迎光临 Chinaunix (http://bbs.chinaunix.net/) Powered by Discuz! X3.2