0

Very new to bash script...

I'm reading conda.sh on my mac and saw below lines of code. I thought "\" is for escaping? See "\dirname" or last line "\export".

__add_sys_prefix_to_path() {
    # In dev-mode CONDA_EXE is python.exe and on Windows
    # it is in a different relative location to condabin.
    if [ -n "${_CE_CONDA}" ] && [ -n "${WINDIR+x}" ]; then
        SYSP=$(\dirname "${CONDA_EXE}")
    else
        SYSP=$(\dirname "${CONDA_EXE}")
        SYSP=$(\dirname "${SYSP}")
    fi

    if [ -n "${WINDIR+x}" ]; then
        PATH="${SYSP}/bin:${PATH}"
        PATH="${SYSP}/Scripts:${PATH}"
        PATH="${SYSP}/Library/bin:${PATH}"
        PATH="${SYSP}/Library/usr/bin:${PATH}"
        PATH="${SYSP}/Library/mingw-w64/bin:${PATH}"
        PATH="${SYSP}:${PATH}"
    else
        PATH="${SYSP}/bin:${PATH}"
    fi
    \export PATH
}

I tried running below commands and got the same outputs.

❯ echo "$(dirname "${CONDA_EXE}")"
/opt/homebrew/Caskroom/miniconda/base/bin
❯ echo "$(\dirname "${CONDA_EXE}")"
/opt/homebrew/Caskroom/miniconda/base/bin

I must be missing something obvious...

JJJJ
  • 178
  • 1
  • 2
  • 9
  • As an aside, see also [Correct Bash and shell script variable capitalization](https://stackoverflow.com/questions/673055/correct-bash-and-shell-script-variable-capitalization) – tripleee Sep 28 '22 at 05:04
  • It did work. d was used as a plain character with no special meaning. – stark Sep 28 '22 at 12:05
  • @stark ah... thanks! Not sure why I was thinking it'll give special meaning to d, maybe I was thinking %... – JJJJ Sep 28 '22 at 16:08

0 Answers0