Quantcast
Viewing all articles
Browse latest Browse all 2722

Macでgit-prompt.sh のPROMPT_DIRTRIM が効かない解決法

起こったこと

Mac terminal(bash) で git-prompt.sh でCommand Lineをいい感じに
整形しようとしたら
現在pathの表示部分が長いときに折りたたむ

PROMPT_DIRTRIM=2

のように PROMPT_DIRTRIMが効かなかった。

解決法

bash のバージョンが古いらしい。(>= v4.0が対応のよう)
ので、バージョンアップ。
(そして利用shellの変更。)

$ brew install bash

# Add the new shell to the list of legit shells
$ sudo bash -c "echo /usr/local/bin/bash >> /private/etc/shells"

# Change the shell for the user
$ chsh -s /usr/local/bin/bash

そしてterminal に入り直す。

参考

https://unix.stackexchange.com/questions/291897/prompt-dirtrim-not-working

https://gist.github.com/samnang/1759336


Viewing all articles
Browse latest Browse all 2722

Trending Articles