Re: do shell script, curl and cookies
Re: do shell script, curl and cookies
- Subject: Re: do shell script, curl and cookies
- From: Doug McNutt <email@hidden>
- Date: Thu, 18 Apr 2013 15:28:25 -0600
At 00:33 -0500 4/18/13, Christopher Stone wrote:
>On Apr 17, 2013, at 04:32, Håvard Graudo <<mailto:email@hidden>email@hidden> wrote:
>
>>do shell script seems to randomize this path on every call, so giving the complete path for the cookie seems to be the way to go with 'do shell script'
>>
>______________________________________________________________________
>
>Hey Håvard,
>
>Not random at all. Quite predictable.
>
>Progressively comment-out only the return result lines.
>
>do shell script "pwd"
>return result
>do shell script "cd ~/Desktop/; pwd"
>return result
>do shell script "pwd"
>return result
One reason for concluding that the directory is not predictable: In Terminal with tcsh:
osascript << END
do shell script "pwd"
return result
END
I get /Users/doug/ which is what curl is expecting if not given a full path with the cookie option. Why any software would default to the system root, where users rarely have write access, escapes me.
cd $HOME/bin
osascript << END
do shell script "pwd"
return result
END
predictably returns /Users/doug/bin/
It appears that Applescript really does nothing when it initiates a shell. The current working directory in the software that is the AppleScript editor is likely what is passed because nothing is done. Isn't it possible that, within some complicated set off Applescript commands, the working directory is not / ? What about other 3rd party AppleScript editors?
In my OS 10.3.9 I use a file $HOME/.MacOSX/environment.plist where I can specify environment variables that are read and made available to do_shell_script requests. I don't do it but it just might be possible to set your default working directory that way. It certainly works for $PATH.
But I have been told that environment.plist is no longer available. I'm stuck on 10.3.9 because I refuse to give up my SE/30 file server. But I do miss AppleScript in Linux. I also miss MPW except on this 8500 where AppleScript doesn't have any problem with do shell script.
--
Applescript syntax is like English spelling:
Roughly, though not thoroughly, thought through.
_______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users
This email sent to email@hidden