カラーbashはrootユーザーとして実行できません

カラーbashはrootユーザーとして実行できません

私はサーバーにsshを接続し、ルートでsuを実行するとbashから色が得られないことがわかりました。この特別なケースでは、「bashから色をインポートしないでください」と言うことは、vimを使ってファイルを編集することを意味します。ログイン後にsudoをすると色が出るので問題ありません。 root とソース /root/.bash_profile に su すると、ルートの色が表示されます。しかし、rootとしてログインするたびに.bash_profileファイルをインポートする必要はありません。私の/root/.bashrcファイルと/root/.bash_profileファイルの内容は次のとおりです。諏訪時に色が出るにはどうすればいいですか?

# .bashrc

# User specific aliases and functions

# You may uncomment the following lines if you want `ls' to be     colorized:
export LS_OPTIONS='--color=auto'
eval "`dircolors`"
alias ls='ls $LS_OPTIONS'
alias ll='ls $LS_OPTIONS -l'
alias l='ls $LS_OPTIONS -lA'

alias rm='rm -i'
alias cp='cp -i'
alias mv='mv -i'


# Source global definitions
if [ -f /etc/bashrc ]; then
     . /etc/bashrc
fi

===============================================

# .bash_profile

# Get the aliases and functions
if [ -f ~/.bashrc ]; then
    . ~/.bashrc
fi

# User specific environment and startup programs

PATH=$PATH:$HOME/bin

export PATH
alias vi='/usr/bin/vim'
alias grep='/bin/grep --color'
export EDITOR=/usr/bin/vim

# HISTSIZE = number of lines in memory while session is ongoing
# HISTFILESIZE = maximum number of lines in the history file on   disk
export HISTSIZE=3000
export HISTFILESIZE=5000
export HISTFILE=/root/history/.bash_hist-$(who -m | awk '{print   $1}')

ベストアンサー1

Get Login Shell を使用するsu -か、別名を次を参照し~/.bashrcてください。スーパーユーザーへの回答

おすすめ記事