Compare commits

...

2 Commits

Author SHA1 Message Date
12b0ca4d52 Update submodules 2022-04-13 18:53:48 -05:00
ae733d53b3 Modify our hostname get in the Bash PS1 to work on systems without hostname installed
Might just switch to that permanently tbh; it's nicer and quicker
2022-04-13 18:53:44 -05:00
5 changed files with 11 additions and 5 deletions

View File

@@ -328,9 +328,15 @@ _ps1bash() {
# Add hostname prefix in SSH sessions
unset _prefix
# Get the system hostname, using a util if one's available
if command -v hostname; then
_hostname="$(hostname -s)"
else
_hostname="$(</etc/hostname)"
fi
# Alert if in an SSH session
if [ -n "$SSH_CLIENT" ] || [ -n "$SSH_TTY" ]; then
_prefix="${fg_bold}${fg_red}$(hostname -s)${r}${fg_red}:${r}${_prefix}"
_prefix="${fg_bold}${fg_red}${_hostname}${r}${fg_red}:${r}${_prefix}"
elif [ "$USER" != "salt" ]; then
_prefix="${fg_bold}${fg_yellow}$USER${r}${fg_yellow}:${r}${_prefix}"
fi