今日单词 和login shell and non-login shell

refute 反驳
snippet 片段
widget 小工具


Sizeof与Strlen的区别与联系

[url]http://www.cnblogs.com/wangtianxj/articles/1502091.html[/url]

What is special about /dev/tty?

[url]http://stackoverflow.com/questions/8514735/what-is-special-about-dev-tty[/url]---/dev/tty stands for the controlling terminal (if any) for the current process.


login shell会执行的脚本通常有 /etc/profile和~/.bash_profile。
non-login shell会执行的脚本通常有/etc/bashrc (在Ubuntu Jaunty 上是/etc/bash.bashrc)和~/.bashrc。

执行shell脚本的三种不同情况(from abao)
[url]http://hi.baidu.com/ladybeta/blog/item/5098d6e67ce9bb25b93820dd.html[/url]

login shell and non_login shell
[url]http://www.linuxquestions.org/questions/linux-general-1/difference-between-normal-shell-and-login-shell-14983/[/url]

A login shell is one whose first character of argument zero is a [b]-[/b], or one started with the -login flag.

An interactive shell is one whose standard input and output are both connected to terminals (as determined by
isatty(3)), or one started with the -i option. PS1 is set and $- includes i if bash is interactive, allowing a
shell script or a startup file to test this state.

Login shells:
On login (subject to the -noprofile option):
if /etc/profile exists, source it.
[b](/etc/profile: system-wide .profile file for the Bourne shell)[/b]
if ~/.bash_profile exists, source it,
else if ~/.bash_login exists, source it,
else if ~/.profile exists, source it.

On exit:
if ~/.bash_logout exists, source it.

Non-login interactive shells:
On startup (subject to the -norc and -rcfile options):
if ~/.bashrc exists, source it.

Non-interactive shells:
On startup:
if the environment variable ENV is non-null, expand
it and source the file it names, as if the command
if [ "$ENV" ]; then . $ENV; fi
had been executed, but do not use PATH to search
for the pathname. When not started in Posix mode, bash
looks for BASH_ENV before ENV.

If Bash is invoked as sh, it tries to mimic the behavior of sh as closely as possible. For a login shell, it
attempts to source only /etc/profile and ~/.profile, in that order. The -noprofile option may still be used to
disable this behavior. A shell invoked as sh does not attempt to source any other startup files.
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值