Prompt for File - Posix path


I would like to use the Prompt for File function to select a file save it to a variable and use it in a shell script. But if the file has spaces in it this won't work. Is there a filter or regex to solve this ?

thx for help

As long as you enclose the variable in quotes in your shell script command, it'll work fine:

cd "$KMVAR_localThePath"

If you run that set to Display Results in a Window, you'll see it works for any path stored in localThePath, even those with spaces.


1 Like

Technically, there is an action designed to do this... Filter action. But it basically does the same thing as Rob’s suggestion, albeit using single quotes instead of double.

For instance, this example (click to expand/collapse)

Returns the following: '/Users/cdthomer/tmp/test file.txt'

Oh no! The single quotes vs. double quotes debate is on the verge of breaking out! :wink: (And you can just as easily enclose the variable in single quotes, if you prefer.)


1 Like

Single quotes for life! Haha j/k, I don’t know enough on the subject to know which is better. I generally just go with whatever doesn’t fail while I’m building/testing macros. :sweat_smile: