2

I've installed anaconda on a mac and I noticed that it appends the following to my .profile:

# added by Anaconda3 5.3.1 installer
# >>> conda init >>>
# !! Contents within this block are managed by 'conda init' !!
__conda_setup="$(CONDA_REPORT_ERRORS=false '/anaconda3/bin/conda' shell.bash hook 2> /dev/null)"
if [ $? -eq 0 ]; then
    \eval "$__conda_setup"
else
    if [ -f "/anaconda3/etc/profile.d/conda.sh" ]; then
        . "/anaconda3/etc/profile.d/conda.sh"
        CONDA_CHANGEPS1=false conda activate base
    else
        \export PATH="/anaconda3/bin:$PATH"
    fi
fi
unset __conda_setup
# <<< conda init <<<

I am a bit perplexed by the escaping of the "\eval" and "\export" lines. What is the purpose of this? I suspect it has something to do with portability, but I have never seen this before.

Can someone explain what purpose it serves?

Cyrus
  • 84,225
  • 14
  • 89
  • 153
Alexandros
  • 2,097
  • 20
  • 27
  • @Spencer: You are correct, my question is indeed a duplicate. Unfortunately it is not always apparent what to search for when you have a question... – Alexandros Jan 31 '19 at 12:12

1 Answers1

2

It's quoted just in case it's aliased to other commands. See following example:

[STEP 101] $ alias foo='echo hello world'
[STEP 102] $ foo
hello world
[STEP 103] $ \foo
bash: foo: command not found
[STEP 104] $

According to bash manaul:

The first word of each simple command, if unquoted, is checked to see if it has an alias. If so, that word is replaced by the text of the alias.

pynexj
  • 19,215
  • 5
  • 38
  • 56