珠海市网站开发公司电话,h5响应式网站如何修改首页,18元套餐,国外域名 网站备案工作中经常碰见环境变量加载问题#xff0c;归根结底就是配置文件的加载问题。 一般会有四种模式#xff1a;交互式登陆、非交互式登陆、交互式非登陆、非交互非登陆。 交互式和非交互式对环境变量的加载: --------------------------------------------------
| …工作中经常碰见环境变量加载问题归根结底就是配置文件的加载问题。 一般会有四种模式交互式登陆、非交互式登陆、交互式非登陆、非交互非登陆。 交互式和非交互式对环境变量的加载: --------------------------------------------------
| | login |interactive|non-interactive|
| | |non-login |non-login |
--------------------------------------------------
|/etc/profile | A | | |
--------------------------------------------------
|/etc/bash.bashrc| | A | |
--------------------------------------------------
|~/.bashrc | | B | |
--------------------------------------------------
|~/.bash_profile | B1 | | |
--------------------------------------------------
|~/.bash_login | B2 | | |
--------------------------------------------------
|~/.profile | B3 | | |
--------------------------------------------------
|BASH_ENV | | | A |
-------------------------------------------------- bash的每种模式会读取其所在列的内容首先执行A然后是BC。而B1B2和B3表示只会执行第一个存在的文件。 交互式登陆简单示例 a.用户直接登陆到机器获得的第一个shell b.用户使用 ssh userremote 获得的shell 非交互式登陆 bash -l script.sh 交互式非登陆 在已有的shell中运行bash此时不需要登陆 非交互式非登陆 a. bash script.sh b. ssh userremote command 为了更好的理清这几种模式下面我们对一些典型的启动方式各属于什么模式进行一个总结 登陆机器后的第一个shelllogin interactive新启动一个shell进程如运行bashnon-login interactive执行脚本如bash script.shnon-login non-interactive运行头部有如#!/usr/bin/env bash的可执行文件如./executablenon-login non-interactive通过ssh登陆到远程主机login interactive远程执行脚本如ssh userremote script.shnon-login non-interactive远程执行脚本同时请求控制台如ssh userremote -t echo $PWDnon-login interactive在图形化界面中打开terminal Linux: non-login interactive 、Mac OS X上: login interactive 参考链接http://feihu.me/blog/2014/env-problem-when-ssh-executing-command-on-remote/转载于:https://www.cnblogs.com/imcati/p/9754481.html