• 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: Integrating Unix scripting in Cocoa app
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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 08:39:05 -0700 (PDT)

--- John Labovitz <email@hidden> wrote:

> 	- A file with the executable bit on.  These, as
> several folks have
> pointed out, will be executed by the kernel, and you
> don't need to
> know anything else about them.

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.

Here's an example:

 $ cat > /tmp/freebird
 echo "I'm as free as a bird now!"
 ^D
 $ chmod a+x /tmp/freebird
 $ /tmp/freebird
 $ sh /tmp/freebird
 I'm as free as a bird now!

> 	- A "plain text" file, with no executable bit or
> extension.  This is
> where it gets difficult.  Which shell should
> interpret this file?
> bash?  csh?  ksh?  All those have different
> syntaxes, so there's no
> right answer.

The pre-Linux assumption/convention was that script
files not beginning with '#!' were Bourne shell
scripts executed with /bin/sh.  However, it seems like
the Linux community defaults to /bin/bash.

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

  • Follow-Ups:
    • Re: Integrating Unix scripting in Cocoa app
      • From: John Labovitz <email@hidden>
References: 
 >Re: Integrating Unix scripting in Cocoa app (From: John Labovitz <email@hidden>)

  • Prev by Date: Re: Integrating Unix scripting in Cocoa app
  • Next by Date: Re: Integrating Unix scripting in Cocoa app
  • Previous by thread: Re: Integrating Unix scripting in Cocoa app
  • Next by thread: Re: Integrating Unix scripting in Cocoa app
  • Index(es):
    • Date
    • Thread