Home » Questions » Computers [ Ask a new question ]

Space in Directory Path in $path Variable in Linux

Space in Directory Path in $path Variable in Linux

I am using Red Hat Enterprise 5.3, and I'm trying to add a directory to my $path variable, but it has spaces in it. The $path variable is space delimited, so how do I differentiate a space in a absolute path from a space that separates the paths?

Asked by: Guest | Views: 48
Total answers/comments: 1
Guest [Entry]

"In my case (using csh) the $PATH variable was messing it up and preventing $path from working, so here is a workaround:

set savePATH = $PATH
set path = ($path /usr/my\ dir/has\ spaces\ in\ it)
set PATH = ($savePATH)

Caveat: paths with spaces must be added last, if you add a non-space path to path after this, it will automatically update $PATH and break it again."