John Summerfied wrote:
Mike McCarty wrote:
John Summerfied wrote:
Mike McCarty wrote:
Which is why, my friends, when I need a quickie one-off I *never* write a script. My longest scripts are no more than 20 lines or so. As soon as I need an "if" I switch to C and write in a language which is documented, understandable, and portable between systems.
When I left the IBM mainframe world in 1981 I left JCL behind,
You could have been using Jol, which is much nicer.
In the early 70s I wrote a set of assembler macros to generate JCL (similar to sysgen). Way better than catalogued procedures.
My boss thought it a great joke when I submitted a job that submitted 50 or so jobs to copy tapes, then went off to college. It seems the computer centre staff got excited at having to do some work, and he took the call.
You could also have bene using TSO command procedures. Note to others; imagine JCL as assembler-like, and TSO (with MVS, before MVS was different) command procedures as akin to a well-structured third-generation language compled with do/end blocks. Statements looked like this: allocate file(fred) dataset(good.stuff) new - space (1000 100) block(4096) round
and have never looked back. Writing long involved scripts is a throw-back to the Jurassic age. Join the 21st Century and abandon shell scripts.
Just my $0.02 worth.
Way overpriced.
How many lines of C is this worth: for f in $(find unix/ common/ -type f -name *.h -o -name *.cxx \ |xargs grep -lw secTypeVncAuth); do vim -c /secTypeVncAuth $f; done
I have no idea, since it is essentially incomprensible goop.
Ah, there's your real problem: you no spika da language!
Untrue.
for f in creates a loop over selected files find standard UNIX utility to traverse the directory structure unix/ ... list of directory tree tops to work upon -type f restrict search to ordinary files -name globbed name, I'd use '*.h' rather than *.h -o sorry, not familiar with this option | pipe to another program xargs not familiar with this program, sorry but looking at it, it looks like it's essentially the same as -exec do ends the file selection list and starts the body vim sorry, not familiar with vim done ends the body of the for loop
I'd not expect anyone who's made an effort to learn about the shell, simple scripting, and the standard *x commandline utilities to have a problem with it.
I have a problem with calling this a "program".
That's the sort of thing I type at the commandline.
Well, I don't want to waste the brain cells.
How long would this take in C?
Nobody would claim that all programming languages are equally suited to all tasks.
[rest of horrible example cut as unworthy of reasonable individual line by line comment]
I'd be ashamed if my C code were so incomprehensible and poorly documented.
We obviously have different ideas about what good programming really means. To almost quote Hoare: There are two ways to write programs. One can make them so simple that there obviously are no defects, or one can make them so complicated that there are no obvious defects. The former is much more difficult.
and nobody does the latter.
Huh? I've encountered *lots* of code in my career which I characterize, not as "it works", but "it no longer fails". The circumstances in which the defects become manifest are very obscure.
And writing long scripts (or indeed longish programs in any language) without commentary is edging into the latter.
If you don't understand the language, you're not qualified to judge the quality or qualities of the code.
Oh, yes I am. When I see lots of code with *no* commentary, I don't have to know the language intimately. All programming languages have some similarities which allow them to be partially understood by anyone who has more than three under his belt. I know very little about Forth or Lisp, but I sure can tell the difference between well-written Forth and badly-written Forth. (Ditto for Lisp.)
I grant you the regular expressions in the second can be a little daunting, but the shell script isn't the place to document how regular expressions work, and of you know how they work then understanding those isn't difficult.
I'm very familiar with GREs.
Expecting annotations in such a script is like expecting a French poet to provide English annotations.
As I said, you seem to be of the sort who writes programs and has a secret (or even not so secret) feeling of superiority when others have difficulty understanding the "clever" methods used in them.
God, please save us from "clever" programmers.
Mike