1
0

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 1 year has passed since last update.

標準設定もイケてるプロンプト Starship のインストール先を /usr/local/bin から変更する方法

Last updated at Posted at 2020-06-13

カスタマイズすれば作業効率が上がるのはわかってるけれど、面倒だなと思うのがコマンドプロンプト。みなさん、どうされてますか?

Rust で書かれたプロンプトが Starship です。インストールも楽々。

curl -fsSL https://starship.rs/install.sh | sh
echo 'eval "$(starship init bash)"' >> ~/.bashrc
source ~/.bashrc

で、プロンプトがなかなかイケてる感じに変貌します。
対応シェルは Bash / Zsh / Powershell / Ion / Fish になっているのもいいのですが、インストール先が /usr/local/bin/ なのです。これを変えたいというのが今回の話。

論よりコード

$HOME/.local/bin/ にする場合は以下のようにします。

curl -fsSL https://starship.rs/install.sh | sh /dev/stdin -f -b $HOME/.local/bin
  • -f は y/N ダイアログをキャンセルしてインストール。
  • -b がインストール先ディレクトリの指定です。

ポイントは curl からの出力を /dev/stdin としているところです。 bash は - だとファイル名として認識してくれないので、そのあとの引数も渡りません。
/dev/stdin で bash には「実行ファイル名」として渡しつつ、標準入力として利用できるようになります。

あとがき

WSL2 の設定をした時のメモです。

参照情報

EoT

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

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?