Search code examples
zshuid

Ungoogleble machine-code or otherwise hard to read EUID part


Not sure whether obfuscated, machine-code or something else. Please, let me know what the part is for and how to read it. The part is from the file.

###############################################################################
# Set prompt based on EUID
################################################################################
if (( EUID == 0 )); then
    PROMPT=$'%{\e[01;31m%}%n@%m%{\e[0m%}[%{\e[01;34m%}%3~%{\e[0;m%}]$(pc_scm_f)%# '
else
    PROMPT=$'%{\e[01;32m%}%n@%m%{\e[0m%}[%{\e[01;34m%}%3~%{\e[0;m%}]$(pc_scm_f)%% '
fi

could someone break it a bit more into parts?

  1. What does the conditional EUID == 0 do?
  2. I get an error about pc_scm_f, using OBSD, is it some sort of value in other OS?
  3. the \e starts some sort of logical part, what do the rest do?

Solution

  • Looks like ANSI escape sequences to me.