How to have a path containing spaces in PATH?
It's not the definition you're having issues with, it's the use.You need to wrap wherever you're using the variable in quotes. See this example:
oli@bert:~/Music$ export B="$HOME/Music/Yeah Yeah Yeahs/"
oli@bert:~/Music$ cd $B
-bash: cd: /home/oli/Music/Yeah: No such file or directory
oli@bert:~/Music$ cd "$B"
oli@bert:~/Music/Yeah Yeah Yeahs$
Try
export TASK="$HOME/Ubuntu\ One"
In both exports you issued, when you echo $TASK, the result is
/home/user/Ubuntu One
This is not the expected behavior because when you write something like
cp $TASK/file somewhere_else/
bash will expand it to
cp /home/user/Ubuntu One/file somewhere_else/
which is, of course, incorrect.
Therefore, we need to put our path in quotation marks, and escape the space.