home *** CD-ROM | disk | FTP | other *** search
- Xref: sparky comp.unix.shell:3735 comp.unix.questions:10611
- Path: sparky!uunet!zaphod.mps.ohio-state.edu!uwm.edu!ogicse!news.u.washington.edu!carson.u.washington.edu!donn
- From: donn@carson.u.washington.edu (Donn Cave)
- Newsgroups: comp.unix.shell,comp.unix.questions
- Subject: Re: Shell Scripts vs. C programs
- Keywords: shell script, C
- Message-ID: <1992Sep1.173604.15563@u.washington.edu>
- Date: 1 Sep 92 17:36:04 GMT
- Article-I.D.: u.1992Sep1.173604.15563
- References: <1992Aug31.211738.1909@tjhsst.vak12ed.edu> <119@steiny.com> <1992Sep1.044434.7193@news.acns.nwu.edu> <121@steiny.com>
- Sender: news@u.washington.edu (USENET News System)
- Organization: University of Washington
- Lines: 55
-
- root@steiny.com (Admin) writes:
-
- |navarra@casbah.acns.nwu.edu (John Navarra) writes:
-
- |>In article <119@steiny.com> steiny@steiny.com (Don Steiny) writes:
- |>|nurban@tjhsst writes:
- |>|
- |>|
- |>|>I've heard that if at all possible, code a program as a shell script
- |>|>rather than coding it in C. Can someone explain the rationale behind
- |>|>this philosophy?
- |>|
- |>| BZZZ - shell scripts are non-portable
- |>|
- |> Huh? Why are shell scripts non-portable? Unless you are using
- |>a non-standard shell, shell scripts are HIGHLY portable!
-
- | The shell may be, but the utilities that the shell calls in order
- | to operate are not, thus, shell scripts are non-portable.
-
- Actually, the shell may be about as bad as the utilities, if by utilities
- you mean things like sed and awk. These will be slightly different, but
- the discrepancies between System V and BSD shells can be quite a pain,
- especially when you have to clean up after someone who didn't know about
- them. C is very portable, by comparison.
-
- | If you accidently misspell a variable name, then the shell simply
- | takes it as a declaration. In the 14 years I have been working
- | professionally with UNIX I have witnessed numerous attempts to write
- | substantial applications in the shell and they have all failed.
-
- I have wondered if it would be possible to develop a reasonably usable shell
- language that would have "software engineering" features for writing large
- systems. For me, that would mean some level of typing, structured types,
- functional scoping, and some way to deal with code in separate modules,
- but I'm sure there's more to it if one were to consult some standard texts
- on this issue. Would be nice to be able to create somewhat complex data
- types, e.g., trees, and store "pointers" to functions, but not necessarily
- the way C does it, maybe more like Lisp. It would of course need to be
- able to run fairly efficient code. Seriously, it would also want to have
- a little style, rather than being a grab-bag amalgam of every known
- programming language, which can impair readability. (Tom, I'm not hostile
- to perl, so don't be bashful about saying perl has all of these things and
- more, but jeez it looks messy.) My rather simplistic attitude is that good
- code can be fiddled with in one place, without unanticipatable side effects
- in other places.
-
- If there's any advantage to such a thing, over C, it would be the sort of
- padded environment that allows programs to be written fairly quickly without
- worrying about dereferencing null pointers and things like that. Ideally,
- it would also be possible to convert straight to C without much re-design,
- so it could be used for prototyping.
-
- Donn Cave, University Computing Services, University of Washington
- donn@cac.washington.edu
-