## make python 2.7 default in ~/.bashrc
echo 'export PATH=/usr/local/lib/python/bin:$PATH' >> ~/.bashrc
source ~/.bashrc
source命令没有重新加载〜/ .bashrc文件 . (但如果我在提示时这样做,则有效)
我如何从脚本重新加载.bashrc?任何帮助将更加欣赏 .
干杯
1 回答
1
啊哈!现代* nix系统通常具有系统范围的 bashrc ,从而开始:
# System-wide .bashrc file for interactive bash(1) shells.
# To enable the settings / commands in this file for login shells as well,
# this file has to be sourced in /etc/profile.
# If not running interactively, don't do anything
[ -z "$PS1" ] && return
...
stuff follows
1 回答
啊哈!现代* nix系统通常具有系统范围的
bashrc
,从而开始:如果观察最后几行,问题就会变得很明显 . 您没有以交互方式运行 . 在您的脚本中采购
bashrc
之前,请将PS1
设置为任意值,例如:很有可能你的
bashrc
会突然从脚本开始加载!