• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag
 

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Do shell script and spaces in path
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Do shell script and spaces in path


  • Subject: Re: Do shell script and spaces in path
  • From: Giuliano Gavazzi <email@hidden>
  • Date: Fri, 19 Apr 2002 22:39:01 +0100

At 9:12 am -0600 2002/04/19, garbanzito wrote:
at 2002 04 19, 11:30 +0100, they whom i call Giuliano Gavazzi wrote:
Thus:

do shell script "ls -l /Desktop\\ Folder"

works.

Now, a single backslash should be allowed, and it should be ignored when not followed by special characters, that is:
"\ " should be equivalent to " ", this seems like a bug, but this is not what you would need in your case anyway.

it's not a bug, it's a common conceptual fallacy. there is
no need to escape the *space* in AppleScript, because
AppleScript has no problem with spaces in strings. you need
to escape the *backslash* so that it reaches the shell,
where it is needed to escape the space.

in AppleScript ...

"\ " = an escaped space, compiles to " " before it reaches
the shell.

no, it does not, as I said "\ " should be equivalent to " ", I did not say it is. And this is the "feature".

"\\ " = an escaped backslash followed by a space. "\ "
reaches the shell.

that is exactly what I said.

The point was that (if you are used to C/C++) the escape characted should give no effect when it is not needed ("ls \afile" is the same as "ls afile"), that is it should be only effective to escape special characters, including itself. (This is the case of C/C++ but not Java).

In AppleScript it appears that the the \ escape can only be used to escape special characters, probably just " and \ (and carriage return, but it gets compiled out anyway).

set dquotes to "\""
display dialog dquotes

-- when compiled the next \ will go away.
set CR to "\
"
display dialog ("a" & CR & "b") as string

set backslash to "\\"
display dialog backslash

set cannotcompile to "\a" -- I would have expected this to be equivalent to "a"

Giuliano

--
H U M P H
|| |||
software

Java & C++ Server/Client/Human Interface applications on MacOS - MacOS X
http://www.humph.com/
_______________________________________________
applescript-users mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/applescript-users
Do not post admin requests to the list. They will be ignored.

  • Follow-Ups:
    • Re: Do shell script and spaces in path
      • From: Christopher Nebel <email@hidden>
    • Re: Do shell script and spaces in path
      • From: garbanzito <email@hidden>
References: 
 >Do shell script and spaces in path (From: Ralf Bitter <email@hidden>)
 >Re: Do shell script and spaces in path (From: Giuliano Gavazzi <email@hidden>)
 >Re: Do shell script and spaces in path (From: garbanzito <email@hidden>)

  • Prev by Date: Re: Mac OS 9 and 10
  • Next by Date: How to read web-based HTML data into a variable without a browser
  • Previous by thread: Re: Do shell script and spaces in path
  • Next by thread: Re: Do shell script and spaces in path
  • Index(es):
    • Date
    • Thread