learning script

Top Page
Attachments:
Message as email
+ (text/plain)
Delete this message
Reply to this message
Author: Craig White
Date:  
Subject: learning script
On Sun, 2004-01-18 at 17:47, Victor Odhner wrote:
> Matt Alexander wrote:
> > On Sun, 18 Jan 2004, Craig White wrote:
> >>GOOD IDEA to put on the first line of any shell script you write...
> >>!#/bin/sh
> > Or even #!/bin/sh ;-)
>
> I would strongly suggest that you do "man bash" and
> read the whole thing through one time. Very revealing.
> It helps you really understand what a shell is,
> and that lets you script more intelligently.
>
> Here's a cool little example. Put this into a
> file, make it executable and run it. It will
> print itself:
>
> #!/bin/cat
> hello world
>
> In this case, /bin/cat is the "command interpreter",
> and it "runs" the file by echoing its lines to
> standard output.
>
> Question: is there a pure Bourne shell (sh) in
> the Free Software domain? My Linux system links
> "sh" to "bash". Since Bourne is the "universal"
> command interpreter, the one you can count on
> being everywhere, most sysadmins in the past have
> made a practice of writing most scripts for Bourne.
> This ensures portability. Sort of like knowing VI
> because it's available on any *nix platform, where
> you might not find emacs. Bash emulates sh, but
> is there a way to tell it to behave as "pure" sh?
> "Man sh" takes me to the "bash" man page.

---
I got the impression that the 'pure' sh is restrictive license but
surely those in the know will pipe up here.

The 'universal' shell isn't apparently universal according to Apple/OS X
- tcsh is supplied and default...bash must be separately downloaded and
installed - well, I didn't check on Panther but certainly through Jaguar
this was the case.

Craig