home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #19 / NN_1992_19.iso / spool / comp / unix / shell / 3724 < prev    next >
Encoding:
Internet Message Format  |  1992-08-31  |  2.4 KB

  1. Xref: sparky comp.unix.shell:3724 comp.unix.questions:10593
  2. Newsgroups: comp.unix.shell,comp.unix.questions
  3. Path: sparky!uunet!cis.ohio-state.edu!zaphod.mps.ohio-state.edu!news.acns.nwu.edu!casbah.acns.nwu.edu!navarra
  4. From: navarra@casbah.acns.nwu.edu (John Navarra)
  5. Subject: Re: Shell Scripts vs. C programs
  6. Message-ID: <1992Sep1.044434.7193@news.acns.nwu.edu>
  7. Keywords: shell script, C
  8. Sender: usenet@news.acns.nwu.edu (Usenet on news.acns)
  9. Organization: Northwestern University, Evanston Illinois.
  10. References: <1992Aug31.211738.1909@tjhsst.vak12ed.edu> <119@steiny.com>
  11. Date: Tue, 1 Sep 1992 04:44:34 GMT
  12. Lines: 43
  13.  
  14. In article <119@steiny.com> steiny@steiny.com (Don Steiny) writes:
  15. >nurban@tjhsst writes:
  16. >
  17. >
  18. >>I've heard that if at all possible, code a program as a shell script
  19. >>rather than coding it in C.  Can someone explain the rationale behind
  20. >>this philosophy?
  21. >
  22. >    BZZZ - shell scripts are non-portable
  23. >
  24.     Huh? Why are shell scripts non-portable? Unless you are using
  25. a non-standard shell, shell scripts are HIGHLY portable! Even if you
  26. aren't using a non-standard shell, say [ba|k|z|]sh, it is highly portable.
  27. For one, most [ba|k|z]sh scripts will run in sh and vice versa. And, if you 
  28. need to, you can always get shell X and compile it on your machine. This is
  29. *usually* easier than rewriting C-code to accomodate your OS. 
  30.  
  31. > there is no error checking,
  32.  
  33.     There isn't? What does this mean? You write error checking
  34. into the shell program just like you write it into C program. 
  35.  
  36. >and they have many other problems.
  37.  
  38.     And translating your C code using compiler X to OS Y is any
  39. easier? Perhaps you are thinking of Csh? Then, yeah, you suck. 
  40.  
  41. >For very short programs shell 
  42. >might be better, but in general C is better for many reasons.
  43.  
  44.     Even for long programs, shell scripts can be better. Yes, they
  45. will run slower but if you can saves days, weeks, or months writing
  46. the shell script, which is better then? It generally takes much longer
  47. to write the same code in C as it does in a shell, perl, or awk. And,
  48. once you have that script written, it is generally trivial to port it
  49. to another machine -- especially if that machine runs the SAME SHELL!
  50.  
  51. -tms
  52. -- 
  53. You can get further with a kind word | You can get further with a kind word
  54. and a gun than a kind word alone.    | and a phaser than a kind word and a gun.
  55.           --al capone                |           -- John Navarra
  56. =======From the Lab of the MaD ScIenTIst....navarra@casbah.acns.nwu.edu========
  57.