mirror of
https://github.com/ItsDrike/dotfiles.git
synced 2024-12-27 05:34:35 +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}"
|
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"}
|
||||||
|
|
Loading…
Reference in a new issue