On Jan 19, 2011, at 1:59 PM, Claudio Braga wrote:

> I need to convert a file path (in the hfs form) to a unix path to start some shell script operations, I thought that something like this: 
> 
> set path to "HD:users:claudio:docs to examine:"
> set path to (posix path of x) 
> 
> would create a real unix kind of path, but I think there is a problem: yes the semicolumn is translated into slash, but the spaces are not treated (i.e. no backslash)
> 
> is it a known behaviour ? Am I using the wrong command ? what is the right procedure to convert a path to a unix path usable in a do shell script line ?

Hi Claudio,

In addition to Mark's comments, here are a couple more. The word "path" is a keyword in AppleScript (from Standard Additions), so shouldn't be used as a variable name. Also, in your sample code you define the first "path" variable, but then reference it as "x". With these things fixed, and Mark's suggestions, you code would look like this:

	set x to "HD:users:claudio:docs to examine:"
	set myPath to quoted form of (posix path of x)

HTH,
Stan C.