我認為這是我的文件的相關部分~/.bashrc
:
# enable color support of ls and also add handy aliases
if [ -x /usr/bin/dircolors ]; then
test -r ~/.dircolors && eval "$(dircolors -b ~/.dircolors)" || eval "$(dircolors -b)"
alias ls='ls --color=auto'
#alias dir='dir --color=auto'
#alias vdir='vdir --color=auto'
alias grep='grep --color=auto'
alias fgrep='fgrep --color=auto'
alias egrep='egrep --color=auto'
fi
(我忘記了從哪裡得到的,所以遺憾的是我無法相信來源。)這是文件alias ls='ls --color=auto'
中該行的唯一出現~/.bashrc
。
煩惱的是:每當我打開提示符號/終端機/bash時,終端機都會回顯
alias ls='ls --color=auto'
(但不是其他!)我想刪除此通知。
編輯:profile
這是我可以在系統上找到的其他文件。
#~/.bash_profile
#!/bin/bash
echo "You've got rhythm. You've got music. Anything else?"
#~/.profile
#unmask 022
if [ -n "$BASH_VERSION" ]; then
if [ -f "$HOME/.bashrc" ]; then
. "$HOME/.bashrc"
fi
fi
if [ -d "$HOME/bin" ] ; then
PATH="$HOME/bin:$PATH"
fi
#/etc/profile
if [ "$PS1" ]; then
if [ "$BASH" ] && [ "$BASH" != "/bin/sh" ]; then
# The file bash.bashrc already sets the default PS1.
# PS1='\h:\w\$ '
if [ -f /etc/bash.bashrc ]; then
. /etc/bash.bashrc
fi
else
if [ "`id -u`" -eq 0 ]; then
PS1='# '
else
PS1='$ '
fi
fi
fi
if [ -d /etc/profile.d ]; then
for i in /etc/profile.d/*.sh; do
if [ -r $i ]; then
. $i
fi
done
unset i
fi
答案1
我在這裡找到了解決方案:https://stackoverflow.com/questions/9652126/bashrc-profile-is-not-loaded-on-new-tmux-session-or-window-why和這裡:https://apple.stackexchange.com/questions/12993/why-doesnt-bashrc-run-automatically
我需要加到source ~/.bashrc
我的.bash_profile
.