1
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

bashやfishの起動時設定ファイル整理

Last updated at Posted at 2018-03-11

bashやzsh, fishの起動時に読み込むaliasや関数を、bashrcなどに定義しておくと思うんですが、だんだん肥大化して管理とか困るな〜という時に。

bashrcに以下を定義する。

for file in "$(find ~/mybash -name '*.bash')";
do
  source $file; 
done

mybash以下にお好きな構成でbashファイル作ればいい感じです。
色々他にもやり方はあるかなと思いますが。

ちなみに僕はfishを使ってるのでこんな感じにしています。

~/.config/fish/config.fishに↓を定義。
~/.config/fish/functions/myfishにお好きなfishファイル。

find ~/.config/fish/functions/myfish -name '*.fish' | while read file
  source $file
end

ちなみに定義を再読み込みさせる場合は以下実行でok。

exec $SHELL -l

fishの設定してみたい人はこちら↓
ログインシェルをfishにしてみる

1
2
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?