Re: Integrating Unix scripting in Cocoa app
Re: Integrating Unix scripting in Cocoa app
- Subject: Re: Integrating Unix scripting in Cocoa app
- From: Kevin Kuehl <email@hidden>
- Date: Tue, 7 Aug 2007 05:01:57 -0700 (PDT)
--- Ron Fleckner <email@hidden> wrote:
> At the moment, I'm assuming
> that the shebang line is the FIRST line of the
> script which makes it
> easy to find.
The '#!" not only has to be on the first line, the two
characters also have to be the first two in the file.
They are a special case for UNIX magic numbers.
Please see: http://en.wikipedia.org/wiki/Sha-bang for
more information.
> My question: Do people ever write shell scripts
> without a shebang
> line or where the shebang line is NOT the first line
> of the script?
The only time I ever leave it out of shell scripts is
when I write code fragments that are not to be
executed on their own. For example, if a script is
meant to be sourced into another one, I'll leave it
out as a reminder not to try to execute the script.
If '#!' are not the first two characters in a file,
there's not much you can do. If you can determine
it's a text file, you could probably try sending it to
/bin/sh and see what happens. I don't think making
the demand that the script either starts with a '#!'
or is a /bin/sh script is too unreasonable. There is
a lot of history to support this choice.
Kevin Kuehl
email@hidden
_______________________________________________
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