dpa@ubu.UUCP (David Angier) (11/24/84)
[Munch..Hmm...Yuck...] I was quite suprised to see a C program to display the output of a shell command string every n seconds. Surely this is an elementry task in shell script. I'm sure that this is one of the main uses of shell script files. It seems stupid to write such minor utilities in C. Here follows a quite adequate display program written in /bin/sh shell script. It could be shortened by making the syntax simpler or removing checks for invalid syntax (half the program.) -----------------------CUT-HERE----------------------------------------------- SLEEP=5 if test $# = 0 then echo Usage: $0 [-seconds] command [command args] exit fi if expr $1 : '-'[0123456789]>/dev/null then SLEEP=`echo $1|tail +2c` shift fi if test $# = 0 then echo Usage: $0 [-seconds] command [command args] exit fi while true do clear $* sleep $SLEEP done Lets have no more silly C programs in net.sources. Dave (Maths @ Warwick University, UK)
peter@rlgvax.UUCP (Peter Klosky) (11/27/84)
XXX > It seems stupid to write such minor utilities in C. > Lets have no more silly C programs in net.sources. Not all of us agree that a small shell script is superior to a small C program. Compare the cost of running "clear" n times with the cost of writing thought-out C code to perform the same task.
henry@utzoo.UUCP (Henry Spencer) (11/29/84)
> > It seems stupid to write such minor utilities in C. > > Lets have no more silly C programs in net.sources. > > Not all of us agree that a small shell script is superior to a small > C program. Compare the cost of running "clear" n times with the cost > of writing thought-out C code to perform the same task. "Cost" measured how? If it's fast enough, it's fast enough; it does not need to be made faster. Civilized people use shell scripts anywhere they can, with C implementations done when, and *only* when, the performance of a shell implementation has proven to be inadequate in real use. This applies to large programs too, by the way. -- Henry Spencer @ U of Toronto Zoology {allegra,ihnp4,linus,decvax}!utzoo!henry
derek@uwvax.UUCP (Derek Zahn) (11/30/84)
> > "Cost" measured how? If it's fast enough, it's fast enough; it does not > need to be made faster. Civilized people use shell scripts anywhere they > can, with C implementations done when, and *only* when, the performance > of a shell implementation has proven to be inadequate in real use. > > This applies to large programs too, by the way. > -- > Henry Spencer @ U of Toronto Zoology Personally, I like C so well that I would rather use C than a shell script. Especially for large programs, and for several reasons. First is the speed. Also, the form of a C program is more easily extendable. It would be a real drag if I wanted to extend either my or somebody else's program only to find that it is a shell script and what I wish to add is something that you cannot do with a shell script. But somehow I still consider myself to be civilized, and will never object to "silly" shell scripts that do things cultured people would do with C :-) "Life's a bummer, and then you die." -- Derek Zahn @ wisconsin ...!{allegra,heurikon,ihnp4,seismo,sfwin,ucbvax,uwm-evax}!uwvax!derek derek@wisc-rsch.arpa
emil@rochester.UUCP (Emil Rainero) (11/30/84)
In article <4698@utzoo.UUCP> henry@utzoo.UUCP (Henry Spencer) writes: >> > It seems stupid to write such minor utilities in C. >> > Lets have no more silly C programs in net.sources. >> >> Not all of us agree that a small shell script is superior to a small >> C program. Compare the cost of running "clear" n times with the cost >> of writing thought-out C code to perform the same task. > >"Cost" measured how? If it's fast enough, it's fast enough; it does not >need to be made faster. Civilized people use shell scripts anywhere they >can, with C implementations done when, and *only* when, the performance >of a shell implementation has proven to be inadequate in real use. > >This applies to large programs too, by the way. Why all the flames in net.sources.bugs? Who cares what the program is written in. If it works and doesn't kill the system, then live and let live. Emil "keep those towers of hanoi programs coming" Rainero UUCP: (..!{allegra, decvax, seismo}!rochester!emil) ARPA: emil@rochester.arpa USmail: Emil Rainero, Dept. of Comp. Sci., U. of Rochester, NY 14627. Phone: Office: (716) 275-5365 Home: (716) 424-5016
tom@uwai.UUCP (11/30/84)
> Personally, I like C so well that I would rather use C than a shell script. > Especially for large programs, and for several reasons. First is the speed. > Also, the form of a C program is more easily extendable. It would be a real > drag if I wanted to extend either my or somebody else's program only to find > that it is a shell script and what I wish to add is something that you cannot > do with a shell script. > > But somehow I still consider myself to be civilized, and will never object to > "silly" shell scripts that do things cultured people would do with C :-) > > "Life's a bummer, and then you die." > > -- > Derek Zahn @ wisconsin > ...!{allegra,heurikon,ihnp4,seismo,sfwin,ucbvax,uwm-evax}!uwvax!derek > derek@wisc-rsch.arpa Rah Derek! -- Tom Christiansen University of Wisconsin Computer Science Systems Lab ...!{allegra,heurikon,ihnp4,seismo,uwm-evax}!uwvax!tom tom@wisc-ai.arpa