我有这个.bash_profile
if [ -n "$TMUX" ]; then
# called inside tmux session, do tmux things
. ~/.profile
fi
# Trigger ~/.bashrc commands
. ~/.bashrc
# ----------------------------------
# Colors
# ----------------------------------
NOCOLOR='\033[0m'
RED='\033[0;31m'
GREEN='\033[0;32m'
ORANGE='\033[0;33m'
BLUE='\033[0;34m'
PURPLE='\033[0;35m'
CYAN='\033[0;36m'
LIGHTGRAY='\033[0;37m'
DARKGRAY='\033[1;30m'
LIGHTRED='\033[1;31m'
LIGHTGREEN='\033[1;32m'
YELLOW='\033[1;33m'
LIGHTBLUE='\033[1;34m'
LIGHTPURPLE='\033[1;35m'
LIGHTCYAN='\033[1;36m'
WHITE='\033[1;37m'
# ~/.bashrc: executed by bash(1) for non-login shells.
# see /usr/share/doc/bash/examples/startup-files (in the package bash-doc)
# for examples
# If not running interactively, don't do anything
case $- in
*i*) ;;
*) return;;
esac
# don't put duplicate lines or lines starting with space in the history.
# See bash(1) for more options
HISTCONTROL=ignoreboth
# append to the history file, don't overwrite it
shopt -s histappend
# for setting history length see HISTSIZE and HISTFILESIZE in bash(1)
HISTSIZE=1000
HISTFILESIZE=2000
# check the window size after each command and, if necessary,
# update the values of LINES and COLUMNS.
shopt -s checkwinsize
# If set, the pattern "**" used in a pathname expansion context will
# match all files and zero or more directories and subdirectories.
#shopt -s globstar
# make less more friendly for non-text input files, see lesspipe(1)
#[ -x /usr/bin/lesspipe ] && eval "$(SHELL=/bin/sh lesspipe)"
# set variable identifying the chroot you work in (used in the prompt below)
if [ -z "${debian_chroot:-}" ] && [ -r /etc/debian_chroot ]; then
debian_chroot=$(cat /etc/debian_chroot)
fi
# set a fancy prompt (non-color, unless we know we "want" color)
case "$TERM" in
xterm-color|*-256color) color_prompt=yes;;
esac
# uncomment for a colored prompt, if the terminal has the capability; turned
# off by default to not distract the user: the focus in a terminal window
# should be on the output of commands, not on the prompt
force_color_prompt=yes
if [ -n "$force_color_prompt" ]; then
if [ -x /usr/bin/tput ] && tput setaf 1 >&/dev/null; then
# We have color support; assume it's compliant with Ecma-48
# (ISO/IEC-6429). (Lack of such support is extremely rare, and such
# a case would tend to support setf rather than setaf.)
color_prompt=yes
else
color_prompt=
fi
fi
if [ "$color_prompt" = yes ]; then
#prompt_color='\[\033[;32m\]'
prompt_color='\[\033[;31m\]'
#info_color='\[\033[1;34m\]'
info_color='\[\033[1;32m\]'
#prompt_symbol=
答案1
可能已经有另一个答案包含此信息,但我只回答而不去寻找它。
.bash_profile 与 .bashrc
因此,.bash_profile
在 Bash 作为交互式登录 shell 调用时执行。.bashrc
在 bash 作为未登录壳。
您可以添加您的提示内容~/.bash_profile
,或者来自~/.bash_profile
< ~/.bashrc
-这很常见。
采购~/.bashrc
示例~/.bash_profile
# ~/.bash_profile
# some lines of stuff
if [ -f ~/.bashrc ]; then
. ~/.bashrc
fi
进一步故障排除
该文件/etc/profile
也是在某个时候被引用的,但我相信这是之前的事情。虽然我们修改了这个文件,但我看到了一些奇怪的事情发生。
如果上述方法不起作用您可以使用~/.bash*
文件内容更新您的问题吗?