0
3

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 5 years have passed since last update.

WSL + VSCode Remoteで.bash_profileの内容を反映させる

Posted at

概要

以前の記事でRuby on Railsの開発環境をWSL上に作ったのは良かったんですが、
Rubyの警告が出るので.bash_profileにexportコマンドを記述し抑制していたのですが
なんとTerminalを立ち上げ直すたびに.bash_profileの中身を無視して警告を出してくるではありませんか!!!

ここではそれの対応策を紹介します

対策法

どうもsource ~/.bash_profileや追加でbashした際に反映されることからVSCode RemoteのTerminalは起動時には.bash_profileを読み込んでくれないみたいです。
起動後bashを実行してやれば反映されるんですが毎回するのは面倒なので起動時に読み込まれるっぽい.bashrcに書き込むことにしました

# bash_profileの内容を.bashrcへ転機
cat ~/.bash_profile >> ~/.bashrc

# bash_profileがなんかの拍子で読み込まれるのを防ぐために名前変更
mv ~/.bash_profile ~/.bash_profile_bak

これで正常に.bashrcに書き込んだ内容がTerminal実行時に読み込まれるようになりました

あとがき

これよく思えば.bash_profileは結果的に読み込まれてないのでタイトル詐欺ですね

0
3
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
0
3

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?