Bash はプロンプトの前にエイリアスの 1 つだけを表示します

Bash はプロンプトの前にエイリアスの 1 つだけを表示します

~/.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

関連情報