shell scripting Re: Converting mp3 to wav

Sriram Thaiyar plug-discuss@lists.plug.phoenix.az.us
Thu, 31 Jan 2002 17:17:45 -0700


* Lynn David Newton <lynn.newton@home.com>:

|  > ok programming is hard enough as it is.  but to remember obscure syntax and
|  > other such stuff is really horrible.  why go through all the pain just
|  > because bourne shell programming is the common denominator
|  
|  Ummm. Sorry to know programming is so painful for you. Some people enjoy it.
|  In any case, of all the languages available to the programmer in the Unix
|  environment, nothing is easier to master than the shell.


programming in shell is painful for me.  programming in common lisp, emacs
lisp, python and scheme is not painful - they make programming fun.  i hope
that someone in this news group can attest to this.  but what i said still
holds: programming is a extremely hard activity.  even donald knuth admits
to this.  heck, it took him 10 years to write TeX.  here is a quote from
him, from his book "selected papers on computer science", in article
"theory and practice, III" (page 144-145):

  The most important lesson I learned during the past nine years is that
  software is hard; and it takes a long time.  From now on I shall have
  significantly greater respect for every successful software tool that I
  encounter.
  ...
  Software creation is not only time-consuming, it's also much more
  difficult that i thought it would be.  Why is this so?  I think the main
  reason is that a longer attention span is needed when you're working on a
  large computer program than when you're doing other intellectual tasks.
  ...

it should be obvious that you have to keep a lot of things in mind when
programming.  now on top of that if a programming language doesn't offer
support but rather make you remember and think about its own syntax, then
of what use is it?  i think that shell syntax does exactly that:  even in a
small example there are so many things that we (the programmer) have to
think about.  so why use it?  (i wonder why you are offended when i ask
such a question, as seen below, when you think that i am starting a flame
war.  please, just answer the question.  i just want an answer.  "maybe you
haven't programmed in shell too much, and thus everytime you use it, you
have to lookup all those syntax extensions" is a possible response from
you.  i just want to make it clear that i am NOT starting a flame war nor
am i interested in joining one; i am just asking a simple question, and am
interested in the answer, that's it.)


|  
|  > - (i think that
|  > not forcing the user to upgrade unnecessarily is a Good Thing.
|  
|  Am I the only one who hasn't a clue what you're talking about here?


what i am saying here is this: most people program in shell script because
that what is guraanteed to be on any system; but why not make the user
upgrade?  what's is wrong with making the user upgrade if the program they
are going to use is not only better, but handles more features and more
convienent for them?


|  
|  > but taken
|  > to an extreme it can really be harmful to everyone...) for example, what
|  > would you prefer, writing 1500 line shell script and actually maintaining
|  > it for say 5 years or writing a 800 line (equivalent) python program and
|  > not worrying about simple things such as, if the user has spaces or other
|  > illegal character in their file names because python takes care of it for
|  > you (i haven't programmed with python too much but i have used scsh and it
|  > takes care of all theses thing for you).  we have just seen how much
|  > problem even a small shell script can give.  so why stick with it?  why not
|  > move on to something better?
|  
|  With all due respect, Sriram, the purpose of this thread was not to start a
|  religious war based on "my scripting language is better than yours", but to
|  expand on the ramifications of an example piece of shell code that some
|  subscriber sent to try to accomplish a simple task.


again, i am not starting a religious war.  i asked two questions "so why
stick with it?" and "why not move on to something better?", in hopes that
the person reading my message will give me a argument/answer that i can
accept.


|  
|  Even if it were an argument about which language is better, it seems that
|  your argument is that it is better to learn a new programming language to
|  perform a task that can be done perfectly well in a language one already
|  knows than to learn how to use a particular programming tool well. I beg to
|  differ on that point.


nope, not my point.  doing that little script in shell script wasn't too
obvious, because things like spaces in the filename pops out of no where,
unexpectedly.  here is a quote from Olin Shiver's (designer & creator of
scsh shell) scsh-paper
("ftp://www-swiss.ai.mit.edu/pub/su/scsh/scsh-paper.ps"):

  Prologue

  Shell programming terrifies me.  There is something about writing a
  simple shell script that is just much, much more unpleasant that writing
  a simple C program, or a simple COMMON LISP programs, or a simple Mips
  assembler program.  Is it trying to remeber what the rules are for all
  the different quotes?  Is it having to look up the multi-phased
  interaction between filename expansion, shell variables, quotation,
  backslashes and alias expansion?  Maybe it's having to subsequently look
  up which of the twenty or thirty flags I need for my grep, sed and awk
  invocations.  Maybe it just gets on my nerves that I have to run two
  complete programs simply to count the number of files in a directory (ls
  | wc -l), which seems like several orders of magnitude more cycles that
  was really needed.

  ...


|  
|  I'm all for learning new programming languages, the more the better. Each
|  one has strengths and weaknesses. Some are better suited for one purpose
|  than another. If you have more tools in your box, you can do a neater job.


what do you mean by "better"?  


|  
|  My personal preference for most scripting tasks is Perl, but I've probably
|  also written ten thousand shell programs in my life. If something is easier
|  to do in Perl, I'll do it in Perl. If it's easier in shell, and much is,
|  I'll do it in shell.
|  
|  I don't personally know Python yet, though it's on my list of things to
|  learn soon, right after I master XML and Ruby. Then maybe I'll use that.
|  
|  Since this is a Linux discussion group, I should point out it is really bash
|  (the Bourne Again shell) that is the so-called common denominator, not the
|  Bourne shell.


thanks you so much for pointing that out!


|  
|  Furthermore, I believe you underestimate the importance of the pervasiveness
|  of the shell in UNIX. Remember that our basic interface to the system is the
|  shell, once you dig through all the GUI goop that we have gotten used to.


please don't use the "we":  i am not used to gui's.  i use emacs.  i don't
need anything else, (well almost).


|  
|  Most of the startup stuff that the system runs to configure things is based
|  in shell. System features such as cron and certain kinds of error logging
|  are based in the shell. Furthermore, the shell is absolutely *always*
|  available on a UNIX system, whereas other programmable tools may not be.
|  (AIX doesn't even come with a C compiler unless you install it specially as
|  a paid-for extra! I always that thought that was the single stupidest fact
|  about AIX.) In Linux, you can have a viable system without a C compiler (but
|  what hacker would want one?), you may decline to install Perl, Python, or
|  any of your other favorites, including some you'll have to go out and locate
|  specially and then install, because they aren't part of any distro. I know
|  Scheme, but I've never even heard of scsh, which you used as an example. But
|  if you've got no shell, you've got no system. It pays to know how to use it.


i do know how to use it.  i have programmed in shell script.  all i am
saying is that most of the time its not useful and its very painful.



|  
|  -- 
|  Lynn David Newton
|  Phoenix, Arizona
|  
|  ________________________________________________
|  See http://PLUG.phoenix.az.us/navigator-mail.shtml if your mail doesn't post to the list quickly and you use Netscape to write mail.
|  
|  PLUG-discuss mailing list  -  PLUG-discuss@lists.plug.phoenix.az.us
|  http://lists.PLUG.phoenix.az.us/mailman/listinfo/plug-discuss