zoukankan      html  css  js  c++  java
  • Login shell and nonLogin shell

    You use an interactive shell when you enter commands at the shell prompt; you use a non-interactive shell when you run a shell script.

    Whenever you log in, the shell that starts is called a LOGIN SHELL. All other interactive shells are called NON-LOGIN SHELLS

    The distinction is important because initialization fi les are processed differently for login shells than for non-login shells.

    1. Virtual consoles and terminal windows
    When you use a desktop environment, such as Gnome or KDE, there are two ways to get to a shell prompt: you can open a terminal window, or you can change to a virtual console When you use a virtual console — say, by pressing <Ctrl-Alt-F1> — you
    are required to log in. When you do, a login shell starts. On the other hand, if you simply open a terminal window, a non-login shell starts (because you did not log in).

    2. Starting a new shell
    At any time, you can start a new shell by entering its name. For example, say you are using Bash, and you want to try the Tcsh. Just enter the tcshcommand. The new shell is a non-login shell (because you did not log in)

    3. Using a remote host
    To connect to a remote Unix host, you use the ssh(Secure Shell) program. Once ssh makes the connection for you, you must log in. Doing so starts a login shell.

    1. A login shell executes your login file andyour environment file.
    2. A non-login shell only executes your environment file

     Thus, your login file should contain commands to (1) create or modify environment variables, and (2) perform all one-time actions.

    As we discussed earlier in the chapter, the environment is automatically inherited by all child processes, including new shells. Thus, you only need to set environment variables (such as PATH) once, in your login file.

  • 相关阅读:
    Teamwork[HDU4494]
    The Parallel Challenge Ballgame[HDU1101]
    「JSOI2016」无界单词
    「SCOI2015」小凸玩密室
    #3636. IIIDX(iiidx)
    #2652. 背单词(word)
    「JXOI2017」加法
    拙者
    19.10.01 acm E:Lowest Common Ancestor
    #3391. big
  • 原文地址:https://www.cnblogs.com/hshuzhao/p/2996509.html
Copyright © 2011-2022 走看看