ubuntu添加了新的path之后,每次xshell登录之后都得source ~/.bashrc才管用。解决过程。
1. 使用lsb_release -a查看ubuntu版本如下:
:~$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 16.04.6 LTS
Release: 16.04
Codename: xenial
2. 查看~/.profile是否存在,如果没有新建一个,拷贝如下内容到.profile文件。 另外如果有vim不能从外部拷贝的问题,可以使用nano ~/.profile编辑,ctrl+x退出编辑,选择y保存。
# ~/.profile: executed by the command interpreter for login shells.
# This file is not read by bash(1), if ~/.bash_profile or ~/.bash_login
# exists.
# see /usr/share/doc/bash/examples/startup-files for examples.
# the files are located in the bash-doc package.
# the default umask is set in /etc/profile; for setting the umask
# for ssh logins, install and configure the libpam-umask package.
#umask 022
# if running bash
if [ -n "$BASH_VERSION" ]; then
# include .bashrc if it exists
if [ -f "$HOME/.bashrc" ]; then
. "$HOME/.bashrc"
fi
fi
# set PATH so it includes user's private bin if it exists
if [ -d "$HOME/bin" ] ; then
PATH="$HOME/bin:$PATH"
fi
3. xshell重新登录,就不用再source。。。了

浙公网安备 33010602011771号