• 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 with unix sub command and CocoaDialog
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Do Shell script with unix sub command and CocoaDialog


  • Subject: Re: Do Shell script with unix sub command and CocoaDialog
  • From: Christopher Nebel <email@hidden>
  • Date: Thu, 6 Mar 2008 13:38:33 -0800

On Mar 6, 2008, at 11:58 AM, Tim Piper wrote:

at the command line this works:

cp -rv /foo/ /Users/Shared/foo/ > >( /Applications/CocoaDialog.app/ Contents/MacOS/CocoaDialog progressbar --title "TITLE")

Note that the verbose output is then being re-directed to a shell sub process,

VERBOSE OUTPUT > REDIRECT space >(SUB PROCESS COMMAND)

The great CocoaDialog shows the progression of files being copied on the screen. very nice.

but when I try and do this via a 'do shell script' I get the following error:

	sh: -c: line 1: syntax error near unexpected token `>'

is it not possible to run sub processes via 'do shell script' ?

From <http://developer.apple.com/technotes/tn2002/tn2065.html>

Q: My command works fine in Terminal, but when I try to use it in do shell script, I get an error about "command not found." What’s going on?
A: There are two possibilities. First, do shell script always uses / bin/sh to interpret your command, not your default shell, which Terminal uses. (To find out what your default shell is, say echo $SHELL in Terminal.) While some commands are the same between shells, others are not, and you may have used one of them. If you write your do shell script scripts in Terminal first, always use sh. You can start sh by typing /bin/sh; type exit to get back to your normal shell.


Second, when you use just a command name instead of a complete path, the shell uses a list of directories (known as your PATH) to try and find the complete path to the command. For security and portability reasons, do shell script ignores the configuration files that an interactive shell would read, so you don’t get the customizations you would have in Terminal. Use the full path to the command, for example, /sbin/ifconfiginstead of just ifconfig. To find the full path in Terminal, say which command-name, for example, which ifconfig; to see the list of places do shell script will search, say do shell script "echo $PATH".



The first bit is the relevant one. Your login shell is probably bash, not sh. There are some differences.


--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
  • Follow-Ups:
    • Re: Do Shell script with unix sub command and CocoaDialog
      • From: Luther Fuller <email@hidden>
References: 
 >Do Shell script with unix sub command and CocoaDialog (From: Tim Piper <email@hidden>)

  • Prev by Date: Re: Sometime error -10006 copying a folder
  • Next by Date: Re: Do Shell script with unix sub command and CocoaDialog
  • Previous by thread: Re: Do Shell script with unix sub command and CocoaDialog
  • Next by thread: Re: Do Shell script with unix sub command and CocoaDialog
  • Index(es):
    • Date
    • Thread