home *** CD-ROM | disk | FTP | other *** search
- Xref: sparky comp.unix.shell:3724 comp.unix.questions:10593
- Newsgroups: comp.unix.shell,comp.unix.questions
- Path: sparky!uunet!cis.ohio-state.edu!zaphod.mps.ohio-state.edu!news.acns.nwu.edu!casbah.acns.nwu.edu!navarra
- From: navarra@casbah.acns.nwu.edu (John Navarra)
- Subject: Re: Shell Scripts vs. C programs
- Message-ID: <1992Sep1.044434.7193@news.acns.nwu.edu>
- Keywords: shell script, C
- Sender: usenet@news.acns.nwu.edu (Usenet on news.acns)
- Organization: Northwestern University, Evanston Illinois.
- References: <1992Aug31.211738.1909@tjhsst.vak12ed.edu> <119@steiny.com>
- Date: Tue, 1 Sep 1992 04:44:34 GMT
- Lines: 43
-
- 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! Even if you
- aren't using a non-standard shell, say [ba|k|z|]sh, it is highly portable.
- For one, most [ba|k|z]sh scripts will run in sh and vice versa. And, if you
- need to, you can always get shell X and compile it on your machine. This is
- *usually* easier than rewriting C-code to accomodate your OS.
-
- > there is no error checking,
-
- There isn't? What does this mean? You write error checking
- into the shell program just like you write it into C program.
-
- >and they have many other problems.
-
- And translating your C code using compiler X to OS Y is any
- easier? Perhaps you are thinking of Csh? Then, yeah, you suck.
-
- >For very short programs shell
- >might be better, but in general C is better for many reasons.
-
- Even for long programs, shell scripts can be better. Yes, they
- will run slower but if you can saves days, weeks, or months writing
- the shell script, which is better then? It generally takes much longer
- to write the same code in C as it does in a shell, perl, or awk. And,
- once you have that script written, it is generally trivial to port it
- to another machine -- especially if that machine runs the SAME SHELL!
-
- -tms
- --
- You can get further with a kind word | You can get further with a kind word
- and a gun than a kind word alone. | and a phaser than a kind word and a gun.
- --al capone | -- John Navarra
- =======From the Lab of the MaD ScIenTIst....navarra@casbah.acns.nwu.edu========
-