Login shell or a non-login shell?
来源:互联网 发布:java 就业委培班 编辑:程序博客网 时间:2024/05/18 03:36
reprint:http://www.theunixschool.com/2010/05/login-shell-or-non-login-shell.html
Login shell or a non-login shell?
Shells in UNIX are classified into two categories:
- Login Shell
- Sub shell (Non-Login shell)
Login shell is a shell where the user reaches on trying to login to his account. This login shell, ksh or bash or tcsh or sh, is defined for the user at the time of user account creation. However, the login shell of an user can always be changed by the root user.
Sub shell or a non-login is a shell which is invoked from the login shell or from a different sub shell by just typing the name of the shell. In fact, whenever a shell script is run, a sub-shell is opened internally and the script is run from the sub-shell.
1. How to go to a sub-shell?
1. How to go to a sub-shell?
Simple, from the current shell, if you want to go to a k-shell, type 'ksh' at the prompt.
#ksh#In the same way, one can switch to any shell by tying the name of the shell at the prompt. In other words, any shell opened from the login shell in the above manner is a sub-shell.
2. How to find out whether the shell is a login-shell or a non-login shell?
Two environment variables are available to find or identify whether a shell is login or sub-shell.
- $SHELL - This always tells the login shell.
- $0 - This always tells the current shell.
i) Login Shell: Assuming the user is currently in his login-shell which is tcsh:
ii) Non-Login shell:
#echo $SHELLtcsh#echo $0tcsh#In this case, both the variables are showing the same value. It is because the login shell and current shell are same in this case.
ii) Non-Login shell:
#echo $SHELLtcsh#ksh#echo $SHELLtcsh#echo $0ksh#As shown above, the user initially is in login shell tcsh and then switches to ksh. On switching to ksh, the $0 shows ksh however the SHELL variable still shows tcsh.
- Login shell or a non-login shell?
- login shell non-login shell
- Login and non-login shell
- login shell and non-login shell
- login shell和non-login shell
- login shell vs non-login shell
- login shell 和 non-login shell
- login shell and non-login shell
- login shell 与non-login shell区别
- login shell 和 non-login shell
- login shell和non-login shell
- login shell和non-login shell
- login shell和non-login shell
- login shell和non-login shell
- Difference between login and non-login shell
- Linux的Login Shell与Non-Login Shell
- login shell 和non-login shell的区别
- login shell和non-login shell环境配置
- HBase配置选项--HRegionServer
- linux下关闭独立显卡
- Java程序优化的一些最佳实践
- 排序算法比较
- Droidbox简介与安装
- Login shell or a non-login shell?
- JAVA的Thread类
- linux下makefile使用
- HTML5基本标记
- 不用临时变量交换两个数据
- felx内嵌jsp
- 利用Intent监听应用程序的安装、替换、删除...
- linux命令-set
- Short Message LPC机理分析