Shell之操作环境
Shell之操作环境
😄 Written by Zak Zhu
学习python风格, 优雅规范书写shell代码
参考
- 鸟哥私房菜(http://cn.linux.vbird.org/linux_basic/0320bash_4.php)
- RHCE培训
- 后进后退//etc/rc.local ; /etc/init.d ;/etc/profile;/etc/bashrc;/.bash_profile;/.bashrc;~/.bash_logout(https://www.cnblogs.com/yuankaituo/p/4271315.html)
命令运行顺序
- 以相对/绝对路径运行命令
- 由Alias找到该命令来运行
- 由BuiltIn的命令来运行
- 通过PATH的顺序搜寻到的第一个命令来运行
欢迎信息
配置文件: /etc/motd
可以在/etc/motd文件中写:
- logo
- 机柜位置, 机器SN号码等物理信息
- 服务器角色
- 操作注意事项
- ...
环境配置
| Global Level | User level | |
|---|---|---|
| Login Shell | /etc/profile | ~/.bash_profile |
| Non-login Shell | /etc/bashrc | ~/.bashrc |
在启动脚本文件中设置环境变量, 别名(alias), 执行命令等作用

-
~/.bash_history
![1]()
-
~/.bash_logout
Run when a login shell exits
Used for:
- Creating automatic backups
- Cleaning out temporary files
![2]()



浙公网安备 33010602011771号