From 02d07f3e3dba0d50b1d907a8062bbaca18f88478 Mon Sep 17 00:00:00 2001 From: Marc Cornellà Date: Thu, 25 Mar 2021 12:08:00 +0100 Subject: fix: use `$USERNAME` guaranteed to always be defined in zsh Fixes #9701 --- themes/adben.zsh-theme | 4 ++-- themes/agnoster.zsh-theme | 2 +- themes/avit.zsh-theme | 2 +- themes/flazz.zsh-theme | 2 +- themes/obraun.zsh-theme | 2 +- themes/re5et.zsh-theme | 2 +- themes/sunrise.zsh-theme | 2 +- 7 files changed, 8 insertions(+), 8 deletions(-) (limited to 'themes') diff --git a/themes/adben.zsh-theme b/themes/adben.zsh-theme index b9ac77d00..7321df724 100644 --- a/themes/adben.zsh-theme +++ b/themes/adben.zsh-theme @@ -89,8 +89,8 @@ function precmd { # Context: user@directory or just directory prompt_context () { - if [[ "$USER" != "$DEFAULT_USER" || -n "$SSH_CLIENT" ]]; then - echo -n "${PR_RESET}${PR_RED}$USER@%m${PR_RESET}${PR_BRIGHT_YELLOW}%~%<<${PR_RESET}" + if [[ "$USERNAME" != "$DEFAULT_USER" || -n "$SSH_CLIENT" ]]; then + echo -n "${PR_RESET}${PR_RED}$USERNAME@%m${PR_RESET}${PR_BRIGHT_YELLOW}%~%<<${PR_RESET}" else echo -n "${PR_RESET}${PR_BRIGHT_YELLOW}%~%<<${PR_RESET}" fi diff --git a/themes/agnoster.zsh-theme b/themes/agnoster.zsh-theme index 99707f684..fe7ddbac6 100644 --- a/themes/agnoster.zsh-theme +++ b/themes/agnoster.zsh-theme @@ -88,7 +88,7 @@ prompt_end() { # Context: user@hostname (who am I and where am I) prompt_context() { - if [[ "$USER" != "$DEFAULT_USER" || -n "$SSH_CLIENT" ]]; then + if [[ "$USERNAME" != "$DEFAULT_USER" || -n "$SSH_CLIENT" ]]; then prompt_segment black default "%(!.%{%F{yellow}%}.)%n@%m" fi } diff --git a/themes/avit.zsh-theme b/themes/avit.zsh-theme index 921ed99d3..1e20d8f9f 100644 --- a/themes/avit.zsh-theme +++ b/themes/avit.zsh-theme @@ -17,7 +17,7 @@ function _user_host() { local me if [[ -n $SSH_CONNECTION ]]; then me="%n@%m" - elif [[ $LOGNAME != $USER ]]; then + elif [[ $LOGNAME != $USERNAME ]]; then me="%n" fi if [[ -n $me ]]; then diff --git a/themes/flazz.zsh-theme b/themes/flazz.zsh-theme index c0a7fb5d0..e21b52ef5 100644 --- a/themes/flazz.zsh-theme +++ b/themes/flazz.zsh-theme @@ -1,4 +1,4 @@ -if [ "$USER" = "root" ] +if [ "$USERNAME" = "root" ] then CARETCOLOR="red" else CARETCOLOR="blue" fi diff --git a/themes/obraun.zsh-theme b/themes/obraun.zsh-theme index 7af44056f..cc2769e4b 100644 --- a/themes/obraun.zsh-theme +++ b/themes/obraun.zsh-theme @@ -1,4 +1,4 @@ -if [ "$USER" = "root" ]; then CARETCOLOR="red"; else CARETCOLOR="blue"; fi +if [ "$USERNAME" = "root" ]; then CARETCOLOR="red"; else CARETCOLOR="blue"; fi local return_code="%(?..%{$fg[red]%}%? ↵%{$reset_color%})" diff --git a/themes/re5et.zsh-theme b/themes/re5et.zsh-theme index 95af1e2ee..bdf342f49 100644 --- a/themes/re5et.zsh-theme +++ b/themes/re5et.zsh-theme @@ -1,4 +1,4 @@ -if [ "$USER" = "root" ]; then CARETCOLOR="red"; else CARETCOLOR="magenta"; fi +if [ "$USERNAME" = "root" ]; then CARETCOLOR="red"; else CARETCOLOR="magenta"; fi local return_code="%(?..%{$fg_bold[red]%}:( %?%{$reset_color%})" diff --git a/themes/sunrise.zsh-theme b/themes/sunrise.zsh-theme index 2111576c3..11f6af127 100644 --- a/themes/sunrise.zsh-theme +++ b/themes/sunrise.zsh-theme @@ -9,7 +9,7 @@ Y=$fg_no_bold[yellow] B=$fg_no_bold[blue] RESET=$reset_color -if [ "$USER" = "root" ]; then +if [ "$USERNAME" = "root" ]; then PROMPTCOLOR="%{$R%}" PROMPTPREFIX="-!-"; else PROMPTCOLOR="" PROMPTPREFIX="---"; -- cgit v1.2.3-70-g09d2