MACSCRPT Archives

February 2009

MACSCRPT@LISTSERV.DARTMOUTH.EDU

Options: Use Monospaced Font
Show Text Part by Default
Show All Mail Headers

Message: [<< First] [< Prev] [Next >] [Last >>]
Topic: [<< First] [< Prev] [Next >] [Last >>]
Author: [<< First] [< Prev] [Next >] [Last >>]

Print Reply
Subject:
From:
"Mark J. Reed" <[log in to unmask]>
Reply To:
Macintosh Scripting Systems <[log in to unmask]>
Date:
Thu, 19 Feb 2009 16:22:33 -0800
Content-Type:
text/plain
Parts/Attachments:
text/plain (76 lines)
How does the curl call "fail"? What directory do they change to to fix
it? I assume the file to be uploaded is an absolute path?

You can certainly cd before the curl:

do shell script "cd /some/where/else; curl ..."

Or, better,

do shell script "cd /some/where/else && curl ..."

Which won't attempt the curl if the cd fails.


On 2/19/09, Stockly, Ed <[log in to unmask]> wrote:
>  Hi,
>
> I have a script that builds a shell script for FTP via CURL.
>
> The script works just fine when run on my machine and several other local
> macs, but when installed on some remote macs the script fails.
>
> On these remote macs the unix admins tell me that curl also fails in
> terminal, but if they change the local directory first then run curl it
> works.
>
> So I have two questions: Can I emulate changing the local directory and
> execute the CURL command in the same shell
>
> and
>
> Why is this happening?
>
> The meat of the script is below
>
> Thanks
>
> ES
> ------------
>
>   set myFile to quoted form of POSIX path of myFile
>
>   set ftpUploadScript to {"/usr/bin/curl"}
>   set the end of ftpUploadScript to " ftp://"
>   set the end of ftpUploadScript to myUserid
>   set the end of ftpUploadScript to ":" & myPassword
>   set the end of ftpUploadScript to "@" & myServer & myRemotePath
>   set the end of ftpUploadScript to " -T"
>   set the end of ftpUploadScript to myFile
>
>   set ftpUploadScript to ftpUploadScript as text
>
>   if debugging then
>     tell application "Finder"
>       activate
>       display dialog ftpUploadScript default answer ftpUploadScript giving
> up after 5
>       set ftpUploadScript to text returned of the result
>     end tell
>   end if
>   set upLoadoutput to do shell script ftpUploadScript
>   if debugging then
>     tell application "Finder"
>       activate
>       display dialog upLoadoutput & return & return & dirStdout giving up
> after 5
>     end tell
>   end if
> -----------
>

-- 
Sent from my mobile device

Mark J. Reed <[log in to unmask]>

ATOM RSS1 RSS2