Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 17 Oct 2017 19:30:20 +0100
From:      "Frank Leonhardt (m)" <frank2@fjl.co.uk>
To:        Warren Block <wblock@wonkity.com>, Paul Pathiakis <pathiaki2@yahoo.com>
Cc:        Paul Schmehl <pschmehl_lists@tx.rr.com>, Polytropon <freebsd@edvax.de>, "freebsd-questions@freebsd.org" <freebsd-questions@freebsd.org>
Subject:   Re: Scripting problem
Message-ID:  <5D3BAA54-3229-4472-8A4D-A10D3F3F07D9@fjl.co.uk>
In-Reply-To: <alpine.BSF.2.21.1710111652460.80616@wonkity.com>
References:  <7AB396F429EEB6890100F082@Pauls-MacBook-Pro.local> <VI1PR02MB1200B33C1F59A223B84E9153F6770@VI1PR02MB1200.eurprd02.prod.outlook.com> <8C8E7D66788801594EC0FC4C@Pauls-MacBook-Pro.local> <20171008100017.30ab5987.freebsd@edvax.de> <88D321A2CCD516AEF39DE8C3@Pauls-MacBook-Pro.local> <alpine.BSF.2.21.1710090615040.94613@wonkity.com> <1984508980.4145408.1507553196491@mail.yahoo.com> <alpine.BSF.2.21.1710111652460.80616@wonkity.com>

next in thread | previous in thread | raw e-mail | index | archive | help


On 12 October 2017 00:01:55 BST, Warren Block <wblock@wonkity.com> wrote:
>On Mon, 9 Oct 2017, Paul Pathiakis wrote:
>
>>> Quoting is sh's biggest weakness. Well, that and lack of basic data
>>> structures, and the weak logical structures, and so on.
>> 
>> ### Well, yes and no. I consider it both a strength and a weakness. I
>find sh to be exactly what I think of a scripting language to be...
>glue. I don't
>> expect to write a fully versed program in sh. I wouldn't be using sh
>for that. I find sh to be that 'tool' to use when I want to call other
>tools and
>> utilities. (sed, awk, tr, etc)
>> 
>> ### I think people have gone way too far in creating 'scripting'
>languages that are more programming languages than scripting....
>Personally, I tried
>> learning PERL which tries to be everything to regex. The problem?
>Lack of coherence... "I can do this 5 different ways in PERL" Is that
>supposed to be a
>> good thing when all five seem to execute at different speeds, using
>different resources, etc? (apologies to Larry Wall and the rest)
>
>The multiple domains that are utterly different are not just in Perl. 
>In sh, you can use sed and awk, which have very little overlap.  In 
>fact, you pretty much have to use sed *and* awk, because each is not 
>quite powerful enough to do particular jobs.  Or use Perl, 
>which is a superset of both.
>
>The trouble with sh is that it is so weak that it takes a lot of code
>to 
>accomplish anything. That comes back to haunt the programmer in the
>long 
>term, because simpler, shorter programs that use more powerful 
>constructs are much easier to maintain.
>
>Perl is much-maligned, but every time I rewrite a shell script in Perl 
>it gets shorter and easier to maintain.  Or longer and more powerful. 
>Python and Ruby are similar.
>
>>> Someone once said that if a script is longer than twenty lines or
>so, 
>>> it probably ought to be done in a real scripting langugage. That was
>
>>> me, but Stephen Bourne has also said it. Yes, that Stephen Bourne.
>> 
>> ### I'll go off a little on this with kind of a corollary.... No sh
>script should be more than 20 lines, however, I typically will call
>shell scripts from
>> other scripts. But I do agree, if you want to program, use a
>programming language. (IMHO, C is still the best, most powerful
>language around but, again,
>> read a book, talk to the people who are in the know - My 'C' guru is
>a guy who has written code that utterly shocked me in its elegance,
>execution, and
>> simplicity - and the occasional "You can do something like that in
>C?" thoughts running through my head.)
>
>The distinction between programming and "scripting" has always been 
>artificial to me.  You write a series of instructions for a computer, 
>that's a program.  Give me powerful tools, I'm not interested in doing 
>it the hard way to build character.  I have enough character. What I 
>want back is the time I spend trying to fix sh scripts.


Interesting debate this. Personally I have always regarded sh as a Job Control Language. Probably showing my age.

As such it's intended for controlling jobs written in 'C' (being Unix). All it had to do is put the data in the right place for input, and arrange for the output to end up where it should. In no way should it be used for implementing an algorithm.

Now people are trying to write programs in it. Why? I suspect its because people haven't invested the time to learn a programming language, as it's quicker to find some cunning way of perverting the JCL one problem at a time.

Do spreadsheet macros count as programming? I've seen complete business management systems written in Excel macros. Unmaintainable and flaky, but I'm in awe that anyone did it.

And if I get too sniffy about the use of structured "proper" languages, I think back to the days of assembler and even machine code. Do the primitive building blocks of assembler count as programming? It's hard to argue otherwise, so therefore the primitive building blocks of sh have to count too.

That said, I was really happy when I could start using 'C' in the early 1980's. The perfect blend of convenience and control of the CPU.

You do need to invest the time to learn a compiled language like 'C'. Friendly interpreted languages are considered cheaper to use  because the staff need less training - or assumed to be. I'm not so sure.

 


-- 
Sent from my phone. Please excuse my brevity.
-- 
Sent from my Android device with K-9 Mail. Please excuse my brevity.
From owner-freebsd-questions@freebsd.org  Tue Oct 17 18:31:33 2017
Return-Path: <owner-freebsd-questions@freebsd.org>
Delivered-To: freebsd-questions@mailman.ysv.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org
 [IPv6:2001:1900:2254:206a::19:1])
 by mailman.ysv.freebsd.org (Postfix) with ESMTP id 197CEE43B6F
 for <freebsd-questions@mailman.ysv.freebsd.org>;
 Tue, 17 Oct 2017 18:31:33 +0000 (UTC)
 (envelope-from frank2@fjl.co.uk)
Received: from bs1.fjl.org.uk (bs1.fjl.org.uk [84.45.41.196])
 (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits))
 (Client CN "bs1.fjl.org.uk", Issuer "bs1.fjl.org.uk" (not verified))
 by mx1.freebsd.org (Postfix) with ESMTPS id A6F9D7DB36
 for <freebsd-questions@freebsd.org>; Tue, 17 Oct 2017 18:31:32 +0000 (UTC)
 (envelope-from frank2@fjl.co.uk)
Received: from [10.144.193.19] ([148.252.129.41]) (authenticated bits=0)
 by bs1.fjl.org.uk (8.14.4/8.14.4) with ESMTP id v9HIVTp8089563
 (version=TLSv1/SSLv3 cipher=DHE-DSS-AES256-SHA bits=256 verify=NO);
 Tue, 17 Oct 2017 19:31:30 +0100 (BST)
 (envelope-from frank2@fjl.co.uk)
User-Agent: K-9 Mail for Android
In-Reply-To: <4a1f6aed-e10a-555a-2179-7e7b1ee7d464@kallab.com>
References: <CAN1es4Lmicq9HQSacA1obfPe9AXjA0B5JAn36OwSCvt3H33SaA@mail.gmail.com>
 <c11fd5bf-7154-ab78-f8fc-08c1315b1015@fjl.co.uk>
 <4a1f6aed-e10a-555a-2179-7e7b1ee7d464@kallab.com>
MIME-Version: 1.0
Subject: Re: FreeBSD 11.1 xen trying to create linux domU instance
From: "Frank Leonhardt (m)" <frank2@fjl.co.uk>
Date: Tue, 17 Oct 2017 19:30:27 +0100
To: Antoine Kallab <antoine@kallab.com>,
 "freebsd-questions@freebsd.org" <freebsd-questions@freebsd.org>
Message-ID: <B2805613-D423-4143-8178-6DF79C4EFA26@fjl.co.uk>
Content-Type: text/plain;
 charset=UTF-8
Content-Transfer-Encoding: 8bit
X-Content-Filtered-By: Mailman/MimeDel 2.1.23
X-BeenThere: freebsd-questions@freebsd.org
X-Mailman-Version: 2.1.23
Precedence: list
List-Id: User questions <freebsd-questions.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/freebsd-questions>, 
 <mailto:freebsd-questions-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/freebsd-questions/>;
List-Post: <mailto:freebsd-questions@freebsd.org>
List-Help: <mailto:freebsd-questions-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/freebsd-questions>, 
 <mailto:freebsd-questions-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Tue, 17 Oct 2017 18:31:33 -0000



On 16 October 2017 15:47:30 BST, Antoine Kallab <antoine@kallab.com> wrote:
>On 08/24/2017 06:10 AM, Frank Leonhardt wrote:
>>(And you may have noticed that the autobridge stuff in rc.conf doesn't
>play anyway).
>
>Would you mind sharing what /does/ work for you?
>

I'll write an article when I have it right; that means I must know why it works too!

I set up a bridge from the command line each time so its different. The trick was DHCP. I have no idea what SYNCDHCP is all about, but it barfs when I use it. I have a DHCP server running on the Dom0 but I think any DHCP server will do. However, if you don't have one (more likely) you can specify the IP address on the line after the addm. I.e.

ifconfig bridge0 addm 192.168.1.7

I have it working fine, but more through luck than brains st present.

Regards, Frank.


-- 
Sent from my Android device with K-9 Mail. Please excuse my brevity.
-- 
Sent from my Android device with K-9 Mail. Please excuse my brevity.
From owner-freebsd-questions@freebsd.org  Tue Oct 17 18:56:39 2017
Return-Path: <owner-freebsd-questions@freebsd.org>
Delivered-To: freebsd-questions@mailman.ysv.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org
 [IPv6:2001:1900:2254:206a::19:1])
 by mailman.ysv.freebsd.org (Postfix) with ESMTP id 3C968E445E4
 for <freebsd-questions@mailman.ysv.freebsd.org>;
 Tue, 17 Oct 2017 18:56:39 +0000 (UTC)
 (envelope-from freebsd@edvax.de)
Received: from mailrelay10.qsc.de (mailrelay10.qsc.de [212.99.163.152])
 (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
 (Client CN "*.antispameurope.com",
 Issuer "TeleSec ServerPass DE-2" (verified OK))
 by mx1.freebsd.org (Postfix) with ESMTPS id BA0D97E847
 for <freebsd-questions@freebsd.org>; Tue, 17 Oct 2017 18:56:38 +0000 (UTC)
 (envelope-from freebsd@edvax.de)
Received: from mx01.qsc.de ([213.148.129.14]) by mailrelay10.qsc.de;
 Tue, 17 Oct 2017 20:56:30 +0200
Received: from r56.edvax.de (port-92-195-74-193.dynamic.qsc.de [92.195.74.193])
 (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits))
 (No client certificate requested)
 by mx01.qsc.de (Postfix) with ESMTPS id D82973CBF9;
 Tue, 17 Oct 2017 20:56:26 +0200 (CEST)
Received: from r56.edvax.de (localhost [127.0.0.1])
 by r56.edvax.de (8.14.5/8.14.5) with SMTP id v9HIuP1Q002828;
 Tue, 17 Oct 2017 20:56:25 +0200 (CEST)
 (envelope-from freebsd@edvax.de)
Date: Tue, 17 Oct 2017 20:56:25 +0200
From: Polytropon <freebsd@edvax.de>
To: "Frank Leonhardt (m)" <frank2@fjl.co.uk>
Cc: Warren Block <wblock@wonkity.com>, Paul Pathiakis <pathiaki2@yahoo.com>,
 Paul Schmehl <pschmehl_lists@tx.rr.com>, Polytropon <freebsd@edvax.de>,
 "freebsd-questions@freebsd.org" <freebsd-questions@freebsd.org>
Subject: Re: Scripting problem
Message-Id: <20171017205625.5690c9f0.freebsd@edvax.de>
In-Reply-To: <5D3BAA54-3229-4472-8A4D-A10D3F3F07D9@fjl.co.uk>
References: <7AB396F429EEB6890100F082@Pauls-MacBook-Pro.local>
 <VI1PR02MB1200B33C1F59A223B84E9153F6770@VI1PR02MB1200.eurprd02.prod.outlook.com>
 <8C8E7D66788801594EC0FC4C@Pauls-MacBook-Pro.local>
 <20171008100017.30ab5987.freebsd@edvax.de>
 <88D321A2CCD516AEF39DE8C3@Pauls-MacBook-Pro.local>
 <alpine.BSF.2.21.1710090615040.94613@wonkity.com>
 <1984508980.4145408.1507553196491@mail.yahoo.com>
 <alpine.BSF.2.21.1710111652460.80616@wonkity.com>
 <5D3BAA54-3229-4472-8A4D-A10D3F3F07D9@fjl.co.uk>
Reply-To: Polytropon <freebsd@edvax.de>
Organization: EDVAX
X-Mailer: Sylpheed 3.1.1 (GTK+ 2.24.5; i386-portbld-freebsd8.2)
Mime-Version: 1.0
Content-Type: text/plain; charset=US-ASCII
Content-Transfer-Encoding: 7bit
X-cloud-security-sender: freebsd@edvax.de
X-cloud-security-recipient: freebsd-questions@freebsd.org
X-cloud-security-Virusscan: CLEAN
X-cloud-security-disclaimer: This E-Mail was scanned by E-Mailservice on
 mailrelay10.qsc.de with CCFCD6836A7
X-cloud-security-connect: mx01.qsc.de[213.148.129.14], TLS=1, IP=213.148.129.14
X-cloud-security: scantime:.1743
X-Mailman-Approved-At: Tue, 17 Oct 2017 20:07:42 +0000
X-BeenThere: freebsd-questions@freebsd.org
X-Mailman-Version: 2.1.23
Precedence: list
List-Id: User questions <freebsd-questions.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/freebsd-questions>, 
 <mailto:freebsd-questions-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/freebsd-questions/>;
List-Post: <mailto:freebsd-questions@freebsd.org>
List-Help: <mailto:freebsd-questions-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/freebsd-questions>, 
 <mailto:freebsd-questions-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Tue, 17 Oct 2017 18:56:39 -0000

On Tue, 17 Oct 2017 19:30:20 +0100, Frank Leonhardt (m) wrote:
> 
> 
> On 12 October 2017 00:01:55 BST, Warren Block <wblock@wonkity.com> wrote:
> >On Mon, 9 Oct 2017, Paul Pathiakis wrote:
> >
> >>> Quoting is sh's biggest weakness. Well, that and lack of basic data
> >>> structures, and the weak logical structures, and so on.
> >> 
> >> ### Well, yes and no. I consider it both a strength and a weakness. I
> >find sh to be exactly what I think of a scripting language to be...
> >glue. I don't
> >> expect to write a fully versed program in sh. I wouldn't be using sh
> >for that. I find sh to be that 'tool' to use when I want to call other
> >tools and
> >> utilities. (sed, awk, tr, etc)
> >> 
> >> ### I think people have gone way too far in creating 'scripting'
> >languages that are more programming languages than scripting....
> >Personally, I tried
> >> learning PERL which tries to be everything to regex. The problem?
> >Lack of coherence... "I can do this 5 different ways in PERL" Is that
> >supposed to be a
> >> good thing when all five seem to execute at different speeds, using
> >different resources, etc? (apologies to Larry Wall and the rest)
> >
> >The multiple domains that are utterly different are not just in Perl. 
> >In sh, you can use sed and awk, which have very little overlap.  In 
> >fact, you pretty much have to use sed *and* awk, because each is not 
> >quite powerful enough to do particular jobs.  Or use Perl, 
> >which is a superset of both.
> >
> >The trouble with sh is that it is so weak that it takes a lot of code
> >to 
> >accomplish anything. That comes back to haunt the programmer in the
> >long 
> >term, because simpler, shorter programs that use more powerful 
> >constructs are much easier to maintain.
> >
> >Perl is much-maligned, but every time I rewrite a shell script in Perl 
> >it gets shorter and easier to maintain.  Or longer and more powerful. 
> >Python and Ruby are similar.
> >
> >>> Someone once said that if a script is longer than twenty lines or
> >so, 
> >>> it probably ought to be done in a real scripting langugage. That was
> >
> >>> me, but Stephen Bourne has also said it. Yes, that Stephen Bourne.
> >> 
> >> ### I'll go off a little on this with kind of a corollary.... No sh
> >script should be more than 20 lines, however, I typically will call
> >shell scripts from
> >> other scripts. But I do agree, if you want to program, use a
> >programming language. (IMHO, C is still the best, most powerful
> >language around but, again,
> >> read a book, talk to the people who are in the know - My 'C' guru is
> >a guy who has written code that utterly shocked me in its elegance,
> >execution, and
> >> simplicity - and the occasional "You can do something like that in
> >C?" thoughts running through my head.)
> >
> >The distinction between programming and "scripting" has always been 
> >artificial to me.  You write a series of instructions for a computer, 
> >that's a program.  Give me powerful tools, I'm not interested in doing 
> >it the hard way to build character.  I have enough character. What I 
> >want back is the time I spend trying to fix sh scripts.
> 
> 
> Interesting debate this. Personally I have always regarded
> sh as a Job Control Language. Probably showing my age.

Well... JCL is more like a "declarative thing", comparable
at least a bit to Solaris SMF, or maybe even systemd... :-)

Using those "characteristic classes" (or programming paradigms),
sh would be an "imperative thing", as it causes actions
directly, instead of having a different subsystem dealing
with the actual programs depending on descriptive text,
i. e., the job deck.



> As such it's intended for controlling jobs written in 'C'
> (being Unix). All it had to do is put the data in the right
> place for input, and arrange for the output to end up where
> it should. In no way should it be used for implementing an
> algorithm.

Additionally, sh is - like JCL - a tool to _combine_ programs
(the steps inside a job), when they need to be run in a
certain order depending on exit code, or piping the output
of one step to the input of the next step.



> Now people are trying to write programs in it. Why? I suspect
> its because people haven't invested the time to learn a
> programming language, as it's quicker to find some cunning
> way of perverting the JCL one problem at a time.

One of the "stupidest" (and actually quite clever) things is
using the null program IEFBR14 (equivalent to /usr/bin/true)
to do things like file creation or deletion. As you see,
even the strictly controlled JCL does actually allow you
to do stupid things, because that's needed in order to do
clever things with it. :-)



> Do spreadsheet macros count as programming? I've seen complete
> business management systems written in Excel macros.
> Unmaintainable and flaky, but I'm in awe that anyone did it.

You can write good and bad code basically in any language.
Some languages encourage bad ideas, bad style, errors, or
"put everything into one place", other languages demand
a certain education and experience to be a good tool (other
than the "shoot your foot" kind of tool).



> And if I get too sniffy about the use of structured "proper"
> languages, I think back to the days of assembler and even
> machine code. Do the primitive building blocks of assembler
> count as programming? It's hard to argue otherwise, so
> therefore the primitive building blocks of sh have to count
> too.

They _are_ building blocks, and using them to solve an
actual program can validly be called programming. I don't
see any problem here.



> That said, I was really happy when I could start using 'C'
> in the early 1980's. The perfect blend of convenience and
> control of the CPU.

No matter which new programming language I learned during
my "career", I always come back to C as my favorite language.
I'm not stupid enough to claim "one size fits all" for C,
as certain tasks can be easier be solved with different
tools. But if you wanted, there would be no problem writing
a feature-rich LOB CRUD bullshit application in C. However,
the language doesn't deserve such a treatment. :-)



> You do need to invest the time to learn a compiled language
> like 'C'. Friendly interpreted languages are considered
> cheaper to use  because the staff need less training - or
> assumed to be. I'm not so sure.

The costs you save on proper training will later return as
costs for maintenance, bugfixes, and expensive consultants
to save your ass in case of fire. The common "business thinking"
is short-term costs vs. long-term costs. Build something for
cheap that partially works - make money. Bugs? Deal with them
later on, or just leave it. It's a hackathon project anyway
so some venture capitalist will pay $100M for "the next big
thing"... :-)



-- 
Polytropon
Magdeburg, Germany
Happy FreeBSD user since 4.0
Andra moi ennepe, Mousa, ...



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?5D3BAA54-3229-4472-8A4D-A10D3F3F07D9>