Re: Shell script fails to return desired results
Re: Shell script fails to return desired results
- Subject: Re: Shell script fails to return desired results
- From: Christopher Nebel <email@hidden>
- Date: Wed, 29 Aug 2007 14:46:18 -0700
On Aug 27, 2007, at 11:34 AM, Rick Dwyer wrote:
I have applescript performing a curl shell script to ftp some files
to a remote directory. I have it working, but I notice a
significant difference between what applescript returns and what
terminal client returns:
Applescript will simply returns:
tell current application
do shell script "curl -P 192.168.80.113 -v -T /TempUploads/
testfile.zip -u username:pass ftp://ftp.remotedirectory.com/"
end tell
almost as if ignoring the -v for the curl command.
Terminal, with the -v command will return the line by line activity
of what transpires. Can applescript capture this information from
the shell command?
I know a work around is to use the --trace-ascii to output the
results to a text file and then read them, but I didn't know if
others have a way of trapping for this information with the initial
shell script request.
From <http://developer.apple.com/technotes/tn2002/tn2065.html>:
---
Q: When I run my command in Terminal, I get a bunch of output, but
when using do shell script, some of it is missing.
A: When running in Terminal, standard output and standard error are
both sent to the same place, so it’s difficult to tell them apart. do
shell script, on the other hand, keeps the two streams separate. If
you want to combine them, follow the command with 2>&1 like this:
do shell script "command 2>&1"
See the sh man page under "Redirection" for more details.
---
The "-v" output from curl goes to stderr, not stdout.
--Chris Nebel
AppleScript Engineering
_______________________________________________
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