[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: implicit linkage



On 10/11/2014 05:28 PM, Steve Litt wrote:
> On Sat, 11 Oct 2014 21:21:14 +0300
> Andrei POPESCU <andreimpopescu@gmail.com> wrote:
> 
>> On Sb, 11 oct 14, 13:40:08, Steve Litt wrote:
>>>
>>> sysvinit is an idea whose time has gone. sysvinit is a poor way to
>>> showcase the Unix Way. First of all, the whole idea of runlevels is
>>> bizarre, and adds a lot of complexity to init scripts. If you
>>> compare a daemontools /service/myserviced/run to an init script,
>>> you'll see an order of magnetude simplification, without
>>> sacrificing the flexibility of a shellscript.
>>
>> Why should I write a script? I'm not a programmer.
> 
> Why should I configure and maintain a firewall? I'm not an admin.
> 
> One's being a "programmer" is such an arbitrary division. OK, you're
> not the first guy I'd call if I wanted a device driver coded, but I'd
> have complete confidence in you to write a short shellscript. And,
> being able to write a short shellscript (which I'm sure you can do),
> would make you a much more able Linux administrator and user.
> 
>>   
>> [snip]
>>
>>> I *might* characterize the preceding as trying to reduce complexity
>>> for the dufus who can't even write a shellscript. However, the cost
>>> of this reduced complexity for the dufus is huge complexity within
>>> the program: complexity even smart people can't work around without
>>> some truly ridiculous kludges.
>>
>> I can write a (simple) shellscript, but I wouldn't dare write an
>> initscript or even a daemontools runscript.
> 
> Daemontools runscripts are incredibly simple shellscripts, that I'm
> sure you could write no sweat except in very wierd edge cases. Here's
> my run script for my home-grown cron substitute:
> 
> ======================================================
> #!/bin/sh
> 
> ####### DON'T START littcrond UNTIL THE NETWORK'S UP #######
> pingaddr=8.8.8.8
> pingaddr=192.168.100.96
> echo littcrond checking network 1>&2
> while ! ping -q -c1 $pingaddr > /dev/null; do
>    sleep 1
>    echo littcrond REchecking network 1>&2
> done
> 
> ####### RUN THE DAEMON #######
> exec envuidgid slitt envdir ./env setuidgid slitt  \
>    /d/at/python/littcron/littcron.py \
>    /d/at/python/littcron/crontab
> ======================================================
> 
> The last three lines are really one line that wordwraps in email. If I
> hadn't checked for the network being up, this would have been a two
> line shellscript. I've known you (online) for several months, and
> although we sometimes disagree, I know you're pretty smart, so I'm
> positive you could have written this shellscript without breaking a
> sweat.
> 
> 
/snip/

I've been using Linux seriously for about five years, altho I diddled
around with it a bit earlier. About the time I started seriously using
it, I took a course in Linux at the local community college, of which
perhaps a third was devoted to scripting. Quite some time earlier, I
had taken a course in Pascal, which I did very well in, and I actually
wrote some useful code in that language for my job as an engineer. 
Prior to that, I used and wrote a lot of stuff in BASIC. 
Getting back to my Linux class, I received a B+. I don't know how much
code I could have actually written when class was over, since one
needs to know a lot more about system commands. At any rate, it's been 
about five years, and I could not now write the script you use to 
illustrate this message, and I'm not really sure I can read it!

BASH scripts are written in perfectly logical code, quite similar, in 
fact, to Pascal. The problem is that they don't have the advantage
of normal language; they rely on all sorts of abbreviations instead
of the English words that more popular programming languages like
Pascal, C, Python, and BASIC use. It's been probably 25 years
since I wrote anything in Pascal or BASIC, but with about 30 minutes
of reference-book research, I think I could go back and do it now.
I can't imagine that to be true with BASH scripting.

Just call me dufus.

--doug


Reply to: