Groups | Search | Server Info | Keyboard shortcuts | Login | Register
Groups > comp.os.linux.development.system > #694
| From | Rainer Weikusat <rweikusat@mobileactivedefense.com> |
|---|---|
| Newsgroups | comp.os.linux.development.system, comp.os.linux.development.apps |
| Subject | Re: UNIX(*)/ Linux history & system design |
| Followup-To | comp.os.linux.development.apps |
| Date | 2014-05-07 22:01 +0100 |
| Message-ID | <87ha51nvzw.fsf@sable.mobileactivedefense.com> (permalink) |
| References | (16 earlier) <lka3vv$r0j$1@dont-email.me> <87zjivatio.fsf@sable.mobileactivedefense.com> <lkchdq$jqn$1@dont-email.me> <87a9atpq7y.fsf@sable.mobileactivedefense.com> <lkdoa0$t83$1@dont-email.me> |
Cross-posted to 2 groups.
Followups directed to: comp.os.linux.development.apps
crankypuss <crankypuss@nomail.invalid> writes:
> On 05/07/2014 09:23 AM, Rainer Weikusat wrote:
[cross-posted to colda with follow-up to, as this is not really about
system development[*]]
[*] It is not terribly on topic, there, either, but 'shell-related
groups' tend to be inhabited by 'strange people' solely busy with
telling others why the shell mustn't be used (a la 'in 1492, on a
DUCStation Donald running Infrix PI - 12, /bin/sh was really a hard link
to /usr/ucb/bbc/cia/doa, therefore, this code is not only not portable
but will actually cause a major earth quake in California' ...) and I'm
more interested in 'using the shell to develop actual applications' than
'Klingon-quoting in hostile environments' ...
[bourne shell language]
>> In addition to constructs specific to its purpose, ie invoking
>> programs, possibly, programs cooperating in a pipeline, it supports the
>> usual syntactic constructs available in 'pre-OO' high-level languages:
>> Three kinds of loop ('loop while a condition is true', 'loop until a
>> condition becomes false', 'loop over the elements of a list'), loop
>> control statements ('break' and 'continue'), conditionals (if .. elif
>> ... elif ... else, a 'case statement' and the possibility to create
>> named subroutines (but not lexically-scoped variables, although bash has
>> them as an extension). It doesn't use braces as universal block
>> delimiter but keywords depending on the 'block construct' being
>> used. For loops, thats do .... done, for if then ... fi and for case, it
>> is case ... esac. The latter two pairs are Algol-68 influenced,
>> presumably, because Steve Bournce (author of the original Bourne shell)
>> was very fond of that. It doesn't support named parameters for functions
>> (or scripts), only positional ones. While I wouldn't to use it (in case
>> suitable alternatives are available) for something larger than at most a
>> few hundred lines of code[*], it is a perfectly usable programming language
>> and often, a very easy to use one.
>>
>> Would you care to elaborate why precisely you consider it to be 'so
>> crude that it is astonishing it didn't vanish'?
[...]
> Only positional parameters for functions,
There are (to the best of my knowledge) the following models for dealing
with 'parameters passed to something'
- assign passed parameters to predefined 'parameter names' 'by
position', possibly with support for optional or 'default
value' arguments
- parameters are passed in form of 'key/value'-pairs where the
'key' designates the name of a possible input parameter and
the value its value
- access passed parameters by position
The first is the one which is most common (nowadays) and it has the nice
property that 'correctness of calls' can be checked statically. OTOH, it
is also the least flexible one. The third is the most general as it can
be used to emulate the other two, either by assigning 'passed
parameters' to 'input parameters' based on position or by interpreting
them as key/value pairs. But it needs explicitly written 'parameter
parsing code' which also needs to determine if the call was sensible/
correct at all. This model is not only also used by 'C programs' (and -
more generally - by anything executed via an exec*-function) but also by
some other programming languages, presumably, because these were
influenced by the shell, notably, Perl (the largest individual Perl
program I'm presently dealing with has 15,666 lines of Perl code and
a few thousand more in auxiliary modules so this is a
perfectly workable model).
> no builtin functions to speak of, which drives the user to
> using sed or some similar external program for even trivial
> functionality.
The main purpose of the shell is to provide facilities for invoking
external programs within a 'global control context' supplying the
facilities for using these 'library routines' in order to solve more
complex problems than what could be done with them in isolation.
Eg, a Bourne shell program for printing the numbers from 0 to 9 could be
n=0
until test $n -gt 9;
do
echo $n
n=`expr $n + 1`
done
this uses three 'external commands', test which performs some kind of
test and signals the result via its exit code, echo which prints its
arguments and expr which evaluated an arithmetic expression and prints
the results. All three may also actually be 'shell builtins' as an
optimization/ performance hack at the expense of some loss in
flexibility eg, at some time in the past, I was using an expr with
support for floating-point arithmetic. This wouldn't work for a shell
builtin.
> It's a very basic script processor, not a language.
The 'shell program' is an interpreter for 'the shell language'.
> On top of that, the bash rules for escaping the characters it has
> coopted for special purposes make it a syntactic nightmare even worse
> than C.
In theory, yes. In practice, "it can be dealt with", especially
considering that a lot of 'shell code' is supposed to operate in a
rather controlled environment.
> The fact that someone kludged control structures onto a simple
> substitution engine does not make it a programming language.
Whether or not something constitutes 'a general-purpose programming
language' is a technical question which can be answered objectively ("Is
it turing-complete?"). That's not at all related to the question if the
programming language is actually useful in practice or who might like or
dislike it for whatever reasons.
Back to comp.os.linux.development.system | Previous | Next — Previous in thread | Next in thread | Find similar
shred or scrub "Bill Cunningham" <nospam@nspam.invalid> - 2014-04-16 18:17 -0400
Re: shred or scrub crankypuss <crankypuss@nomail.invalid> - 2014-04-17 04:19 -0600
Re: shred or scrub "Bill Cunningham" <nospam@nspam.invalid> - 2014-04-18 22:30 -0400
Re: shred or scrub Jasen Betts <jasen@xnet.co.nz> - 2014-04-19 07:42 +0000
Re: shred or scrub Richard Kettlewell <rjk@greenend.org.uk> - 2014-04-19 10:04 +0100
Re: shred or scrub crankypuss <crankypuss@nomail.invalid> - 2014-04-19 02:15 -0600
Re: shred or scrub Rainer Weikusat <rweikusat@mobileactivedefense.com> - 2014-04-19 23:05 +0100
Re: shred or scrub crankypuss <crankypuss@nomail.invalid> - 2014-04-20 02:47 -0600
Re: shred or scrub John Hasler <jhasler@newsguy.com> - 2014-04-20 07:56 -0500
Re: shred or scrub crankypuss <crankypuss@nomail.invalid> - 2014-04-21 03:51 -0600
Re: shred or scrub Jasen Betts <jasen@xnet.co.nz> - 2014-04-21 11:50 +0000
Re: shred or scrub crankypuss <crankypuss@nomail.invalid> - 2014-04-21 06:14 -0600
Re: shred or scrub "Bill Cunningham" <nospam@nspam.invalid> - 2014-04-21 18:44 -0400
Re: shred or scrub Rainer Weikusat <rweikusat@mobileactivedefense.com> - 2014-04-21 13:24 +0100
Re: shred or scrub crankypuss <crankypuss@nomail.invalid> - 2014-04-22 04:10 -0600
Re: shred or scrub Rainer Weikusat <rweikusat@mobileactivedefense.com> - 2014-04-22 14:39 +0100
Re: shred or scrub Kristof Provost <kristof@codepro.be> - 2014-04-17 13:15 +0000
Re: shred or scrub John Hasler <jhasler@newsguy.com> - 2014-04-17 09:40 -0500
Re: shred or scrub Kristof Provost <kristof@codepro.be> - 2014-04-18 14:40 +0000
Re: shred or scrub crankypuss <crankypuss@nomail.invalid> - 2014-04-18 02:12 -0600
Re: shred or scrub David Brown <david.brown@hesbynett.no> - 2014-04-18 11:49 +0200
Re: shred or scrub crankypuss <crankypuss@nomail.invalid> - 2014-04-18 09:59 -0600
Re: shred or scrub David Brown <david.brown@hesbynett.no> - 2014-04-21 16:14 +0200
Re: shred or scrub crankypuss <crankypuss@nomail.invalid> - 2014-04-22 04:22 -0600
Re: shred or scrub David Brown <david.brown@hesbynett.no> - 2014-04-23 00:06 +0200
Re: shred or scrub crankypuss <crankypuss@nomail.invalid> - 2014-04-23 05:50 -0600
Re: shred or scrub David Brown <david.brown@hesbynett.no> - 2014-04-24 22:46 +0200
Re: shred or scrub crankypuss <crankypuss@nomail.invalid> - 2014-04-25 03:57 -0600
Re: shred or scrub Rainer Weikusat <rweikusat@mobileactivedefense.com> - 2014-04-25 19:14 +0100
Re: shred or scrub crankypuss <crankypuss@nomail.invalid> - 2014-04-26 04:02 -0600
Re: shred or scrub Rainer Weikusat <rweikusat@mobileactivedefense.com> - 2014-04-27 21:26 +0100
Re: shred or scrub crankypuss <crankypuss@nomail.invalid> - 2014-04-28 03:27 -0600
Re: shred or scrub Rainer Weikusat <rweikusat@mobileactivedefense.com> - 2014-04-28 12:17 +0100
Re: shred or scrub Rainer Weikusat <rweikusat@mobileactivedefense.com> - 2014-04-28 13:01 +0100
Re: shred or scrub crankypuss <crankypuss@nomail.invalid> - 2014-04-29 02:50 -0600
UNIX(*)/ Linux history & system design (was: shred or scrub) Rainer Weikusat <rweikusat@mobileactivedefense.com> - 2014-05-05 21:31 +0100
Re: UNIX(*)/ Linux history & system design crankypuss <crankypuss@nomail.invalid> - 2014-05-05 16:02 -0600
Re: UNIX(*)/ Linux history & system design David Brown <david.brown@hesbynett.no> - 2014-05-06 01:17 +0200
Re: UNIX(*)/ Linux history & system design crankypuss <crankypuss@nomail.invalid> - 2014-05-06 01:46 -0600
Re: UNIX(*)/ Linux history & system design Rainer Weikusat <rweikusat@mobileactivedefense.com> - 2014-05-06 15:09 +0100
Re: UNIX(*)/ Linux history & system design crankypuss <crankypuss@nomail.invalid> - 2014-05-06 23:47 -0600
Re: UNIX(*)/ Linux history & system design Rainer Weikusat <rweikusat@mobileactivedefense.com> - 2014-05-07 16:23 +0100
Re: UNIX(*)/ Linux history & system design crankypuss <crankypuss@nomail.invalid> - 2014-05-07 10:51 -0600
Re: UNIX(*)/ Linux history & system design Jerry Peters <jerry@example.invalid> - 2014-05-07 20:25 +0000
Re: UNIX(*)/ Linux history & system design crankypuss <crankypuss@nomail.invalid> - 2014-05-08 03:50 -0600
Re: UNIX(*)/ Linux history & system design Jerry Peters <jerry@example.invalid> - 2014-05-08 20:24 +0000
Re: UNIX(*)/ Linux history & system design crankypuss <crankypuss@nomail.invalid> - 2014-05-09 02:23 -0600
Re: UNIX(*)/ Linux history & system design Rainer Weikusat <rweikusat@mobileactivedefense.com> - 2014-05-09 18:36 +0100
Re: UNIX(*)/ Linux history & system design Rainer Weikusat <rweikusat@mobileactivedefense.com> - 2014-05-09 21:24 +0100
Re: UNIX(*)/ Linux history & system design Rainer Weikusat <rweikusat@mobileactivedefense.com> - 2014-05-07 22:01 +0100
Re: UNIX(*)/ Linux history & system design crankypuss <crankypuss@nomail.invalid> - 2014-05-08 03:37 -0600
Re: UNIX(*)/ Linux history & system design Rainer Weikusat <rweikusat@mobileactivedefense.com> - 2014-05-08 14:02 +0100
Re: UNIX(*)/ Linux history & system design crankypuss <crankypuss@nomail.invalid> - 2014-05-09 02:56 -0600
Re: UNIX(*)/ Linux history & system design David Brown <david.brown@hesbynett.no> - 2014-05-07 00:15 +0200
Re: UNIX(*)/ Linux history & system design crankypuss <crankypuss@nomail.invalid> - 2014-05-07 00:32 -0600
Re: UNIX(*)/ Linux history & system design Jorgen Grahn <grahn+nntp@snipabacken.se> - 2014-05-07 08:47 +0000
Re: UNIX(*)/ Linux history & system design crankypuss <crankypuss@nomail.invalid> - 2014-05-07 10:59 -0600
Re: UNIX(*)/ Linux history & system design Rainer Weikusat <rweikusat@mobileactivedefense.com> - 2014-05-06 14:35 +0100
Re: shred or scrub David Brown <david.brown@hesbynett.no> - 2014-04-26 16:30 +0200
Re: shred or scrub crankypuss <crankypuss@nomail.invalid> - 2014-04-27 05:59 -0600
Re: shred or scrub Rainer Weikusat <rweikusat@mobileactivedefense.com> - 2014-04-27 20:15 +0100
Re: shred or scrub crankypuss <crankypuss@nomail.invalid> - 2014-04-28 03:29 -0600
Re: shred or scrub Rainer Weikusat <rweikusat@mobileactivedefense.com> - 2014-04-28 12:06 +0100
Re: shred or scrub David Brown <david.brown@hesbynett.no> - 2014-04-27 21:41 +0200
Re: shred or scrub crankypuss <crankypuss@nomail.invalid> - 2014-04-28 04:03 -0600
Re: shred or scrub Richard Kettlewell <rjk@greenend.org.uk> - 2014-04-28 16:44 +0100
Re: shred or scrub David Brown <david.brown@hesbynett.no> - 2014-04-28 23:39 +0200
Re: shred or scrub John Hasler <jhasler@newsguy.com> - 2014-04-18 07:37 -0500
Re: shred or scrub crankypuss <crankypuss@nomail.invalid> - 2014-04-18 10:16 -0600
Re: shred or scrub John Hasler <jhasler@newsguy.com> - 2014-04-18 12:01 -0500
Re: shred or scrub Kristof Provost <kristof@codepro.be> - 2014-04-18 14:42 +0000
Re: shred or scrub David Brown <david.brown@hesbynett.no> - 2014-04-17 16:41 +0200
csiph-web