`
wwwjjq
  • 浏览: 55790 次
社区版块
存档分类
最新评论

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

 
阅读更多
refute    反驳
snippet    片段
widget   小工具



Sizeof与Strlen的区别与联系

http://www.cnblogs.com/wangtianxj/articles/1502091.html

What is special about /dev/tty?

http://stackoverflow.com/questions/8514735/what-is-special-about-dev-tty---/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)
http://hi.baidu.com/ladybeta/blog/item/5098d6e67ce9bb25b93820dd.html

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

A login shell is one whose first character of argument zero is a -, 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.
(/etc/profile: system-wide .profile file for the Bourne shell)
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.
分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics