Re: Integrating Unix scripting in Cocoa app
Re: Integrating Unix scripting in Cocoa app
- Subject: Re: Integrating Unix scripting in Cocoa app
- From: John Labovitz <email@hidden>
- Date: Tue, 7 Aug 2007 08:51:48 -0700
On Aug 7, 2007, at 8:39 AM, Kevin Kuehl wrote:
Although it's a minor nit, it is an important one, but
if the file is a script, then the first two bytes must
be '#!'. If the first two bytes are not a valid magic
number, the kernel won't "execute" it.
Yes, that's true, and I'm sorry I didn't make that explicit. I was
thinking about the issue from the point of the app that is dealing
with the scripts, and what it needed to do in terms of determining
how to run a given script. If a user provides a script with the x
bit on but no shebang, there'll most certainly be an error -- but it
won't be an error of Ron's app's interpretation. In other words, I'd
suggest putting up a helpful error rather than second-guessing the user.
The pre-Linux assumption/convention was that script
files not beginning with '#!' were Bourne shell
scripts executed with /bin/sh.
Ah, I'd forgotten about that. Thanks.
--John
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden