Escape space character in pathfile?
The shell uses a space character as a separator between words, so paths containing spaces always must be put in "" when used (which implies that it is recommended/best practice to ensure that all paths and file names in shell scripts and init files are properly quoted):

ANKI_MEDIA="/Users/&lt;username&gt;/Library/Application\ Support/Anki2/me/collection.media"
cd "$ANKI_MEDIA"


You can also use \ to protect a space but this only works for literal paths, not for variables:

cd /Users/&lt;username&gt;/Library/Application\ Support/Anki2/me/collection.media


If applying quotes each time you change into this directory is inconvenient you can use an alias instead:

alias cdanki="cd '$ANKI_MEDIA'"