mirror of
https://github.com/ItsDrike/dotfiles.git
synced 2024-11-10 02:39:40 +00:00
Use ternary conditionals
This commit is contained in:
parent
cd08fbd55d
commit
d448a66cef
|
@ -272,11 +272,12 @@ function anonymize {
|
|||
|
||||
|
||||
OLD_LINE="%F{047}%n%f %F{027}"
|
||||
if [ -z "$MACHINE" ]; then
|
||||
NEW_LINE="${NAME_COLOR}${NAME}%f ${DIR_COLOR}"
|
||||
else
|
||||
NEW_LINE="${NAME_COLOR}${NAME}${AT_COLOR}@${MACHINE_COLOR}${MACHINE}%f ${DIR_COLOR}"
|
||||
fi
|
||||
|
||||
[ -n "$NAME" ] && NEW_LINE="${NAME_COLOR}${NAME}"
|
||||
[ -n "$NAME" ] && [ -n "$MACHINE" ] && NEW_LINE="${NEW_LINE}${AT_COLOR}@"
|
||||
[ -n "$MACHINE" ] && NEW_LINE="${NEW_LINE}${MACHINE_COLOR}${MACHINE}"
|
||||
[ -n "$NAME" ] || [ -n "$MACHINE" ] && NEW_LINE="${NEW_LINE}%f "
|
||||
NEW_LINE="${NEW_LINE}${DIR_COLOR}"
|
||||
|
||||
# Use new anonymized name, machine and colors in PS1
|
||||
PS1=${PS1/"$OLD_LINE"/"$NEW_LINE"}
|
||||
|
|
Loading…
Reference in a new issue