freshshell/fresh

Paths with spaces

lewiseason opened this issue · 2 comments

I have some files, the names of which contain spaces, and I'm using a for loop to iterate through them and put them in the right place. It looks something like this:

for file in editors/st3/*; do
  path="~/.config/sublime-text-3/Packages/User/`basename \"$file\"`"
  fresh "$file" --file="$path"
done

When I run this, fresh says:

$ fresh
/home/leason/bin/fresh: eval: line 450: syntax error near unexpected token `('
/home/leason/bin/fresh: eval: line 450: `echo ~/.config/sublime-text-3/Packages/User/Default (Linux).sublime-keymap'

It looks like the path isn't being quoted when being passed to echo.

My quick fix for this is to use sed to add escape characters, but this clearly isn't great:

for file in editors/st3/*; do
  path="~/.config/sublime-text-3/Packages/User/`basename \"$file\"`"
  path=$(echo "$path" | sed -e 's/ /\\ /g' -e 's/(/\\(/g' -e 's/)/\\)/g')
  fresh "$file" --file="$path"
done

Is this a bug with fresh? Could the path be quoted? Or even, is there a nicer way I can do escaping myself in my .freshrc

This is definitely a bug and I’m happy to report that it’s now fixed. Thanks!

That was speedy! Thanks!