Rocky Linux9 のシェルをbashからzshへ変更する。

いろいろ事情があって、より高機能なzshに乗り換えることにしたので備忘に。
macもzshだし、いいだろうということで。
# 現在のシェル
$ echo $SHELL
/bin/bash
#zshのインストール
$ sudo dnf install zsh
# chshコマンドはutil-linux パッケージに含まれてるらしい
$ sudo dnf install util-linux-user
# デフォルトシェルの変更
$ chsh -s $(which zsh)
Changing shell for yngdrsk.
Password: 
Shell changed.
# なんかファンキーなものを勧められたので素直に従う
# Oh My Zshのインストール
$ sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"
Shell successfully changed to '/usr/bin/zsh'.
         __                                     __   
  ____  / /_     ____ ___  __  __   ____  _____/ /_  
 / __ \/ __ \   / __ `__ \/ / / /  /_  / / ___/ __ \ 
/ /_/ / / / /  / / / / / / /_/ /    / /_(__  ) / / / 
\____/_/ /_/  /_/ /_/ /_/\__, /    /___/____/_/ /_/  
                        /____/                       ....is now installed!
Before you scream Oh My Zsh! look over the `.zshrc` file to select plugins, themes, and options.
➜  ~ 
# ~/.bashrcの内容をそのまま~/.zshrcの末尾にコピー
# .bashrcのファイル内容はそのままzshでも動くってChatGPT先生に教えてもらったw
$ cat ~/.bashrc >> ~/.zshrc
# するとエラーが出たのよく見てみると /etc/bashrc を読みに行くようになってた
 $ exec zsh
/etc/bashrc:39: command not found: shopt
omz_history:fc:22: no such event: 1
/etc/bashrc:42: command not found: shopt
/etc/bashrc:53: command not found: shopt
/etc/profile.d/debuginfod.sh:9: no matches found: /etc/debuginfod/*.urls
# なのでその部分を削除
続いて、/etc/bashrc と /etc/zshrc の記述内容の違いと、bashからzshに移植した方がよい機能と記述についてChatGPTに教えてもらって、その通りやったww
# /etc/zshrc に移植した方がいいのは
# 履歴の追加設定 (APPEND_HISTORY):とのこと。
# /etc/zshrcの末尾に下の1行を追加
setopt APPEND_HISTORY
#そして再度
$ exec zsh 
これでOKじゃないでしょうか!






ディスカッション
コメント一覧
まだ、コメントがありません