My .bashrc:
# show a short way
shortwd() {
num_dirs=3
pwd_symbol="..."
newPWD="${PWD/#$HOME/~}"
if [ $(echo -n $newPWD | awk -F '/' '{print NF}') -gt $num_dirs ]; then
newPWD=$(echo -n $newPWD | awk -F '/' '{print $1 "/.../" $(NF-1) "/" $(NF)}')
fi
echo -n $newPWD
}
# show git branch
git_branch() {
git symbolic-ref HEAD --short
}
export PS1='\n$CONDA_PROMPT_MODIFIER\e[38;5;211m$(shortwd)\e[38;5;48m [$(git_branch)]\e[0m$'
now the bash look like:
(base) /.../MyCode/python [master]$
but after I run conda activate env
to switch my conda env. It get a BUG that,whatever command I run ,there always show the current conda env name in the end of command output.like this:
(base) /.../MyCode/python [master]$ls
code_study keras mxnet my_tools other pyqt5 pytorch qt_diankeyuan test windowsCode
(base)
If I want to make the conda env name do not always show in end of the each command output,what should I do?