シェルをkshからbashに変更し、.profileでプロンプトを変更します。

シェルをkshからbashに変更し、.profileでプロンプトを変更します。

私の.profileでこれを使用して、ログイン時にbashに切り替えます。

case $- in
  *i*)
    # Interactive session. Try switching to bash.
    if [ -z "$BASH" ]; then # do nothing if running under bash already
      bash=$(command -v bash)
      if [ -x "$bash" ]; then
        export SHELL="$bash"
        exec "$bash -l"
      fi
    fi
esac

Bashシェルが開いた後、次のコマンドを自動的に実行する方法はありますか?

PS1='\[\e[1;91m\][\u@\h \w]\$\[\e[0m\] '

その行を.bash_profileに入れましたが、プロンプトは変更されません。

ベストアンサー1

対話型シェルの場合は、代わりにPS1次の行を入力してソースを指定してください。~/.bashrc~/.profile

source ~/.bashrc 

(またはログアウト/ログイン)

また、シェルを永久に変更するには、次の手順を実行します。

chsh -s /bin/bash

またはrootとして使用またはvipw編集します。editor /etc/passwd

おすすめ記事