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?
- What does the conditional
EUID == 0
do? - I get an error about
pc_scm_f
, using OBSD, is it some sort of value in other OS? - the
\e
starts some sort of logical part, what do the rest do?
المحلول
Looks like ANSI escape sequences to me.
نصائح أخرى
I found this link which seems to contain the whole thing in proper context. Also tells me Ferruccio is right: It's an ANSI escape string, used to change the style of the command-prompt. \e starts the escape codes, the rest is the code itself. Used to be very popular in the old DOS time, especially with a game called NetHack. It's just pretty-print for your console.
لا تنتمي إلى StackOverflow