Ah ha! The quotes MegaArcon! The quotes! Why thank you Infinite Recursion. Looking at your code helped to spark what I was missing. Instead of subbing in "\ " I can just sub in " " and surround my variable with double quotes for the cd.
New code:
#!/bin/bash
MYDIR=/users/cs/study/gordon/MyxyXYWhitespacEYXyxDocuments
MYDIR=${MYDIR//xyXYWhitespacEYXyx/ }
echo $MYDIR
cd "$MYDIR"
ls
New output:
/users/cs/study/gordon/My Documents
Desktop My Pictures foo.doc
Ah, good ol' bash. Thanks again.
