I'm trying to run a script which uses my $HOME
variable to set things up (it's gitolite, by the way).
However, it's failing because I'm on a system where the home directory path has spaces in it.
I want to hack the gitolite bash script at a single point so $HOME
turns into something it can work with -- it gets used several times in the script and beyond, and in some places is concatenated to form subfolders, so wrapping it in "" won't work.
So to clean it up I need to say something like:
$HOME=(magic here)$HOME
(This is of course assuming that 开发者_StackOverflow社区the perl scripts that come later don't also read the $HOME
variable direct and also need fixing...)
Use quotes everywhere.
HOME="/Users/Foo Bar"
WORKDIR="$HOME"/Work
PLAYDIR="$HOME"/Games
MARATHONDIR="$PLAYDIR"/Marathon
Try this:
export HOME=`echo $HOME | sed -e "s/ /\\ /g"`
Hope that works for you!
精彩评论