improve $HOME detection for superuser on macOS

On macOS, root's $HOME is '/var/root' but '/var' is a symlink to '/var/private'. Consequently, $HOME ('/var/'root') never matches a normalized $PWD ('/var/private/root') and '~' is never displayed.
This commit is contained in:
Luca Filipozzi 2019-10-27 22:15:21 -07:00 committed by GitHub
parent 144eed0acc
commit 8343418e73
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -359,7 +359,7 @@ function __bobthefish_path_segment -S -a segment_dir -d 'Display a shortened for
switch "$segment_dir"
case /
set directory '/'
case "$HOME"
case (builtin realpath "$HOME")
set directory '~'
case '*'
set parent (__bobthefish_pretty_parent "$segment_dir")