My $PS1 \h is showing as “unknown”. Being set in .bash_profile [closed]
-
01-07-2021 - |
Question
My $PS1
in Bash is set to:
\[${BOLD}${MAGENTA}\]\u \[$WHITE\]at \[$ORANGE\]\h \[$WHITE\]in \[$GREEN\]\w\[$WHITE\]\$([[ -n \$(git branch 2> /dev/null) ]] && echo \" on \")\[$PURPLE\]\$(parse_git_branch)\[$WHITE\]
But is showing up like:
Jesse at unknown2837371d98a2 in ~
Why is my hostname (\h
) showing up as unknown?
Solution
The problem is that you have such hostname. Please check it using hostname
.
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow