第一步 系统级设置
读取/etc/profile文件,再根据/etc/profile文件的内容去读取其他附件的设置文件,例如/etc/profile.d/*.sh等
第二步 个人设置
根据不同的用户,到家目录去读取~/.bash_profile或~/.bash_login或~/.profile设置文件
其中:
这三个文件通常只要一个即可,不过存在顺序上的差异:bash启动时,会先去读取~/.bash_profile,找不到时就去读取~/.bash_login,再找不到时则读取~/.profile
根据不同的用户,到家目录去读取~/.bashrc文件
所以登陆bash后,最终读取的设置文件是~/.bashrc,通常可以将个人的一些常用的alias或者PATH等环境变量或者自定义变量都写到这个文件。
ps: 可能需要注意区分login shell 与 non-login shell
A login shell is one whose first character of argument zero is a -, or one started with the --login option.
An interactive shell is one started without non-option arguments and without the -c option whose standard input and error are both connected to the terminal , or one started with the -i option.
Login Shell: 登录的时候,你输入帐号和密码进入了,出现了shell提示符,这个过程就是登录外壳;
Interactive Shell:接下来你得到了一个像root@host />这样的提示符,你输入什么,它就解释出什么,这就是交互式外壳;
Non Interactive Shell:你可能需要学习写一个bash script,用外部shell执行:bash script.sh,它(bash)从第一条命令执行到最后一条然后退出,不与你进行任何交互,它就是非交互式外壳
详见:
man 1 bash 之 INVOCATION
" a non-login shell, which does not read /etc/profile or ~/.bash_profile files, but rather reads the ~/.bashrc instead."
http://simplyzhao.is-programmer.com/posts/6701.html
分享到:
相关推荐
/etc/profile: 此文件为系统的每个用户设置环境信息,当用户第一次登录时,该文件被执行。并从 /etc/profile.d 目录的配置文件中搜集shell的设置。 /etc/bashrc: 为每一个运行 bash shell 的用户执行此文件。当 ...
vebs:用于Vagrant(或Ubuntu 14.04)环境的可重用Bash设置脚本
一键部署:一键部署Ubuntu开发环境。一键部署Ubuntu开发环境
在Ubuntu中启动4终端窗口的脚本。 您可以将其添加到启动中,以便在操作系统启动时触发脚本。 该脚本必须适合您的屏幕分辨率。 说明视频: https://youtu.be/nB-Ct-CsDgo : https://youtu.be/nB-Ct-CsDgo 引诱 用于...
该项目会自动配置大多数Linux发行版(基于CentOS / Ubuntu / Debian以及其他版本)的通用设置。 包含用于WSL的其他特定工具,仅在检测到WSL时才加载。 单个脚本custom_loader.sh设置了所有内容,只需删除~/.bashrc...
它特别针对Windows上的Bash在Ubuntu上的用户-bash环境是一个相当新的环境。 换句话说:在这里,我们分享有关Windows上的Ubuntu上的Bash的资源,技巧,已知问题等。1.如何在Windows 10(Linux的Windows子系统)的...
目录 1.1 Anaconda安装 1.2 pycharm安装 1.3 tensorflow-gpu安装 1.1 Anaconda安装 通过镜像源找到自己需要安装的版本:Index of /anaconda/archive/ |...之后打开终端运行下面命令:bash+空格+需要安装的文件路径
Unix/Linux经典shell,bash-4.3.30...编译环境:Ubuntu-16.04-LTS,32位,GCC编译器:crosstools-mips-gcc-5.3-linux-4.1-uclibc-1.0.12-binutils-2.25-NPTL,mips-buildroot-linux-uclibc-gcc-5.3,链接库方式:static
Ubuntu开发环境 运行以下命令以安装功能部件: curl -s https://raw.githubusercontent.com/hbraux/ubuntu/main/install.sh | bash -s FEATURE ... 支持的功能: 默认(env git ntp docker sbt maven docker) 智慧...
更多内容,请查看博客原文:Ubuntu环境搭建Go语言开发环境 下载Golang安装文件 官方下载页面:https://golang.org/dl/ 也可以到国内下载地址下载:https://studygolang.com/dl 我下载的版本是go1.12.14,下载到/usr/...
不同的script执行方式会造成不一样的结果,尤其对bash的环境影响很大,脚本的执行方式有大概以下几种方式。 首先写一个简单的test.sh文件: #!/bin/bash read -p Please input your first name: firstname read -p ...
如果你安装Ubuntu的时候不是用的“hadoop”用户,那么需要增加一个名为hadoop的用户 sudo useradd -m hadoop -s /bin/bash 接着使用如下命令设置密码,可简单的设置为hadoop,按提示输入两次密码: sudo passwd ...
shell-tools: dotfiles 和 helpers 安装 始终可以从此 repo 安装(或更新)最新稳定版本的 shell-...Ubuntu 8 长期支持: git clone git://github.com/altercation/vim-colors-solarized.git mv vim-colors-solarized
git:Git帮助器:一个使git bash环境变得用户友好的仓库
Unix/Linux经典shell,bash-5.0...编译环境:Ubuntu-16.04-LTS,32位,GCC编译器:crosstools-mips-gcc-5.3-linux-4.1-uclibc-1.0.12-binutils-2.25-NPTL,mips-buildroot-linux-uclibc-gcc-5.3,链接库方式:static
新版本的go有更好的性能,ubuntu软件库只有交旧的版本,通过源码安装go1.2 具体步骤: 1、去官网下载go1.1.2的tarball,我下载到tem目录 2、打开终端cd /usr/local, tar -zxvf go1.1.2.linux-386.tar.gz 将源码文件解...
这些是设置新环境时首先要使用的基本点文件。 对于更具体的本地需求,我使用“部分中描述的*.local文件。 目录 建立 要设置点文件,请在终端中运行相应的代码段: ( :warning: 如果您不完全...
对于 Ubuntu(服务器和桌面): bash <(curl -s https://raw.githubusercontent.com/zhiyuanshi/laptop/master/ubuntu.sh) 2>&1 | tee ~/laptop.log Ubuntu 桌面的附加功能: bash <(curl -s ...
要全用Bash/WSL也比较简单,首先要先打开开发者模式( 设置 → 更新和安全 → 针对开发人员 → 开发人员模式), 然后在控制面板 → 程序 → 启用Windows功能 → Windows Subsystem for Linux (Beta)对Bash功能进行...
3.2 Bash 设置..............................................26 3.3 鼠标设置...............................................26 3.4 NFS 设置...............................................29 3.5 Samba 设置...