shell scripting Re: Converting mp3 to wav

Lynn David Newton plug-discuss@lists.plug.phoenix.az.us
Thu, 31 Jan 2002 15:17:19 -0700


> 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.

> - (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?

> 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.

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.

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.

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.

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.

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.

-- 
Lynn David Newton
Phoenix, Arizona