Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

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
add comment

5 Answers

up vote 7 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
add comment

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.

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
add comment

This page explains the issue in detail. It's a good idea to read it thoroughly http://mywiki.wooledge.org/Arguments

share|improve this answer
add comment

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
add comment

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
add comment

Your Answer

 
discard

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.