• 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: Paths & quoted form & do shell script
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Paths & quoted form & do shell script


  • Subject: Re: Paths & quoted form & do shell script
  • From: Martin Orpen <email@hidden>
  • Date: Sat, 08 Oct 2005 23:14:33 +0100
  • Thread-topic: Paths & quoted form & do shell script

on 8/10/05 23:06, Mark J. Reed at email@hidden wrote:

> On 10/8/05, Martin Orpen <email@hidden> wrote:
>> But, I wanted my script to check a text file that may have been written to
>> disk the previous time that the script was run and grab the file path from
>> that file.
>>
>> When I do that I get the shell choking on the path:
>>
>>     set tFile to (path to temporary items as string) & "PSLogTest.txt"
>>     set thePath to paragraph 1 of (read file tFile)
>
> What does thePath contain at this point?

-->  "/Users/martinorpen/Documents/Photoshop Edit Log.txt"


>>     do shell script "/usr/bin/grep -i saved " & quoted form of thePath
>
>
>>     sh: -c: line 1: unexpected EOF while looking for matching `''
>>     sh: -c: line 2: syntax error: unexpected end of file
>
> That looks to me like the pathname has an apostrophe in it that isn't
> getting quoted properly.  I'd really need tosee what that line looks
> like to diagnose the problem.

The final line is exactly what I'd expect:

/usr/bin/grep -i saved '/Users/martinorpen/Documents/Photoshop Edit Log.txt'

If I paste that into Terminal it will work as I expect too!

But "do shell script" will not work as expected.

>> BTW, is there an easy way of getting an *escaped form* of a POSIX path
>> without having to write a handler to do it?
>
> I don't understand the question.  You're looking for something other
> than "quoted form of"?

Yep. I'm looking for an *escaped form* of a path:

/Users/martinorpen/Documents/Photoshop\ Edit\ Log.txt

The same as you get if you drag a file or folder on the Terminal window.

Regards

--
Martin Orpen


 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Applescript-users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

  • Follow-Ups:
    • Re: Paths & quoted form & do shell script
      • From: "Mark J. Reed" <email@hidden>
    • Re: Paths & quoted form & do shell script
      • From: Doug McNutt <email@hidden>
References: 
 >Re: Paths & quoted form & do shell script (From: "Mark J. Reed" <email@hidden>)

  • Prev by Date: Re: Paths & quoted form & do shell script
  • Next by Date: Re: Best practice for activation of another application
  • Previous by thread: Re: Paths & quoted form & do shell script
  • Next by thread: Re: Paths & quoted form & do shell script
  • Index(es):
    • Date
    • Thread