Use ternary conditionals

This commit is contained in:
ItsDrike 2021-07-20 23:10:46 +02:00
parent cd08fbd55d
commit d448a66cef
No known key found for this signature in database
GPG key ID: B5F6B41F708C3ADD

View file

@ -272,11 +272,12 @@ function anonymize {
OLD_LINE="%F{047}%n%f %F{027}" OLD_LINE="%F{047}%n%f %F{027}"
if [ -z "$MACHINE" ]; then
NEW_LINE="${NAME_COLOR}${NAME}%f ${DIR_COLOR}" [ -n "$NAME" ] && NEW_LINE="${NAME_COLOR}${NAME}"
else [ -n "$NAME" ] && [ -n "$MACHINE" ] && NEW_LINE="${NEW_LINE}${AT_COLOR}@"
NEW_LINE="${NAME_COLOR}${NAME}${AT_COLOR}@${MACHINE_COLOR}${MACHINE}%f ${DIR_COLOR}" [ -n "$MACHINE" ] && NEW_LINE="${NEW_LINE}${MACHINE_COLOR}${MACHINE}"
fi [ -n "$NAME" ] || [ -n "$MACHINE" ] && NEW_LINE="${NEW_LINE}%f "
NEW_LINE="${NEW_LINE}${DIR_COLOR}"
# Use new anonymized name, machine and colors in PS1 # Use new anonymized name, machine and colors in PS1
PS1=${PS1/"$OLD_LINE"/"$NEW_LINE"} PS1=${PS1/"$OLD_LINE"/"$NEW_LINE"}