Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I tried

export TASK=$HOME/Ubuntu\ One and export TASK="$HOME/Ubuntu One"

but neither works.

share|improve this question
TASK or PATH? Are you setting PATH using TASK? If so, how? – Mikel Feb 14 '11 at 22:54
up vote 9 down vote accepted

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$
share|improve this answer


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.

share|improve this answer
That's wrong. Did you try it? If you do this, cp sees the backslash, and cp doesn't handle backslashes, the shell does. – Mikel Feb 14 '11 at 22:56

This page explains the issue in detail. It's a good idea to read it thoroughly

share|improve this answer

This awkward and clumsy behaviour is the result of an unwise choice in the name of the "Ubuntu One" directory. Unfortunately, there seems to be no fix planned for this.

One option is to use Dropbox, which offers similar functionality.

share|improve this answer

Rather than resorting to Dropbox, I made a symbolic link:

ln -s Ubuntu\ One UbuntuOne

In my particular case I wanted to import python modules from a directory on my cloud:

ln -s Ubuntu\ One/pythonfiles pythonfiles
export PYTHONPATH="$PYTHONPATH:$HOME/pythonfiles/"

I agree, it is idiotic to put spaces in linux filenames.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.