I'm trying to create an environment variable so that I can use it to change directories faster. But I've tried many ways to escape spaces and special characters, but can't get it to work. For example:
I can cd using the bash terminal:
cd /c/Users/name/OneDrive\ -\ Company\,\ Inc/Documents/FOO\ BAR\ Projects/
But if I create an environment variable like this, it doesn't work:
export MY_PROJECT_PATH=/c/Users/name/OneDrive\ -\ Company\,\ Inc/Documents/FOO\ BAR\ Projects/
If I wrap it in quotes like this, it also doesn't work:
export MY_WORK_PATH="/c/Users/name/OneDrive\ -\ Company\,\ Inc/Documents/FOO\ BAR\ Projects/"
If I take out the escape characters and wrap it in quotes, it also doesn't work. In every case, I get "too many arguments" error in bash terminal (I'm assuming it still can't handle the spaces and comma).
I also have some file path environment variables in my Windows environment without spaces and special characters that work universally in both Windows cmd and Bash terminal. I would like to get it working in both, but I'd settle for just Bash.
I just want to be able cd like this:
cd $MY_PROJECT_PATH