<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="zh-Hans-CN">
	<id>http://202.127.29.3/~shen/wiki/index.php?action=history&amp;feed=atom&amp;title=Shell%E7%9A%84%E6%A8%A1%E5%BC%8F</id>
	<title>Shell的模式 - 版本历史</title>
	<link rel="self" type="application/atom+xml" href="http://202.127.29.3/~shen/wiki/index.php?action=history&amp;feed=atom&amp;title=Shell%E7%9A%84%E6%A8%A1%E5%BC%8F"/>
	<link rel="alternate" type="text/html" href="http://202.127.29.3/~shen/wiki/index.php?title=Shell%E7%9A%84%E6%A8%A1%E5%BC%8F&amp;action=history"/>
	<updated>2026-04-07T18:22:12Z</updated>
	<subtitle>本wiki上该页面的版本历史</subtitle>
	<generator>MediaWiki 1.38.1</generator>
	<entry>
		<id>http://202.127.29.3/~shen/wiki/index.php?title=Shell%E7%9A%84%E6%A8%A1%E5%BC%8F&amp;diff=3313&amp;oldid=prev</id>
		<title>Shen：​创建页面，内容为“==login shell 和 no-login shell==  *“login shell” 代表用户登入, 比如使用 “su -“ 命令, 或者用 ssh 连接到某一个服务器上, 都会使用…”</title>
		<link rel="alternate" type="text/html" href="http://202.127.29.3/~shen/wiki/index.php?title=Shell%E7%9A%84%E6%A8%A1%E5%BC%8F&amp;diff=3313&amp;oldid=prev"/>
		<updated>2020-09-07T11:05:25Z</updated>

		<summary type="html">&lt;p&gt;创建页面，内容为“==login shell 和 no-login shell==  *“login shell” 代表用户登入, 比如使用 “su -“ 命令, 或者用 ssh 连接到某一个服务器上, 都会使用…”&lt;/p&gt;
&lt;p&gt;&lt;b&gt;新页面&lt;/b&gt;&lt;/p&gt;&lt;div&gt;==login shell 和 no-login shell==&lt;br /&gt;
&lt;br /&gt;
*“login shell” 代表用户登入, 比如使用 “su -“ 命令, 或者用 ssh 连接到某一个服务器上, 都会使用该用户默认 shell 启动 login shell 模式.&lt;br /&gt;
该模式下的 shell 会去自动执行 /etc/profile 和 ~/.profile 文件, 但不会执行任何的 bashrc 文件, 所以一般再 /etc/profile 或者 ~/.profile 里我们会手动去 source bashrc 文件.&lt;br /&gt;
&lt;br /&gt;
*而 no-login shell 的情况是我们在终端下直接输入 bash 或者 bash -c “CMD” 来启动的 shell.&lt;br /&gt;
该模式下是不会自动去运行任何的 profile 文件.&lt;br /&gt;
&lt;br /&gt;
*所以  profile 是某个用户唯一的用来设置环境变量的地方, 因为用户可以有多个 shell 比如 bash, sh, zsh 之类的, 但像环境变量这种其实只需要在统一的一个地方初始化就可以了, 而这就是 profile.&lt;br /&gt;
&lt;br /&gt;
==interactive shell 和 non-interactive shell==&lt;br /&gt;
*interactive shell 是交互式shell, 顾名思义就是用来和用户交互的, 提供了命令提示符可以输入命令.&lt;br /&gt;
该模式下会存在一个叫 PS1 的环境变量, 如果还不是 login shell 的则会去 source /etc/bash.bashrc 和 ~/.bashrc 文件&lt;br /&gt;
&lt;br /&gt;
*non-interactive shell 则一般是通过 bash -c “CMD” 来执行的bash.&lt;/div&gt;</summary>
		<author><name>Shen</name></author>
	</entry>
</feed>