![]() |
Holy shit. I was able to complete my largest and most complex shell script to date, autotest.sh. It was a nearly total rewrite of a series of scripts that act as an automated testing environment.
That sounds fancy, but it's not. The basic idea is that as you edit, you save a lot. Well, I do. Now every time I save, the change is noticed and the script is run automatically. It even goes one step further, doing some debugging if your script fails to run.
Intro ∞
I had this working as a small script, and then I extended it to handle two-step execution with Boo (first compiling with boo's booc
, then executing with mono
)
Then I switched from Bash to Zsh. This revealed an entirely new kind of problem: shell scripting often relies on builtins which are specific to one shell and are not available or which work differently on another shell.
I got some help with that problem, see my earlier post Make a script learn what shell it's running in.
hosting ∞
I won't be providing the script here, because this is a terrible medium for that sort of thing. I'm not entirely sure where I could post it and still expect reasonable quality of service. I think I'll just maintain my scripts on my own site, since I'll always be frustrated at other people's sites. This brings up all kinds of interesting old problems. I want to make myself a few self-hosting script engines that'll automatically and intelligently build pages from files on my disk. Ok, enough of that.. on with the story.
update: It's in https://github.com/spiralofhope/shell-random/tree/master/README.markdown
learning bash in one week ∞
(Bash)
If this automated testing isn't interesting enough, all of this came from a one-week review of bash.
Let me explain this another way. I've been a Linux user for a long time now. Here's a hint: Yggdrasil Linux/GNU/X would have been my first distro if the CD I got with the book wasn't bad. In all my time as a Linux user, even after having been a great MS-DOS 5 through 6.22 scripter, and a fair 4DOS scripter, and somehow making Tcl do things that bent time and space and then forgetting how I made all those scripts, and lastly stumbling through Ruby for an embarrassing number of years.. after all of that, I still couldn't figure bash out.
I mean, it was and still is incomprehensible unusable GNU software.
I don't know what happened, but I took a week and.. and I learned it. I just absorbed everything I came across, troubleshooted every problem in no time and even started doing things that bash wasn't supposed to be able to do.
That's part of the "holy shit".
learning boo ∞
I then picked up Boo. I just wanted to toy with something else, and see if I could learn something totally alien that I hadn't even heard of before. I figured things out easily enough, although I didn't spend nearly enough time to really get into it. I may revisit it or I may just hummingbird along onto something else. I have a few candidates already.
learning zsh ∞
(Zsh)
The other part is that I got fed up with bash being GNU software and I decided to switch to Zsh. This forced me to rewrite a bunch of scripts, and I began to understand more about properly-POSIX-compliant scripting which will be universal.
rewriting a complex script ∞
After writing that last blog posting, I decided I'd take a stab at rewriting a half-broken kludgy and badly-written semi-compilation script.
I spent a few hours rewriting it. I had no issues keeping the whole script "in my head" and not getting confused, breaking it down into usable chunks, writing and rewriting sections as the inspiration caught me, implementing new features, doing solid commenting, and even becoming more strict about my shoddy syntax.
And after all that time, I never ran it once. I mean, it's the very test suite that I'd normally run to test scripting out. I suppose I could have tested it through an earlier version of itself, but I didn't feel like doing that.
I ended up having a kind of confidence when programming, which I haven't felt in a long time. Once I ran this script, the bugs I found were related to my new strict syntax demands or implementing new features that I didn't quite understand fully. There were no stupid or "oops I forgot about that feature" type issues like I've always had in the past. There was nothing major broken.
marked improvements ∞
All of this reveals a set of long-time quirks and limitations that I've finally improved upon, and a number of programmer talents which I thought I'd never have access to.
- Learning a whole language or new method isn't intimidating at all.
- I can now pick up new programming methods, and tear apart snippets of code, with good speed.
- I can better understand the problems to solve.
- I can easily break a problem down into component parts as comments, and then build code up around those comments to solve those problems.
- Troubleshooting is nearly trivial. I can easily figure out what part of the code an issue is related to, how I test further to learn more, how to get answers and learn/implement alternates to a troublesome bit of code.
- Refactoring is effortless, even when I have to stop the block of programming I'm working on to refactor elsewhere.
- I can pick up some old script of mine, even one that's not well documented, and understand and rewrite it with ease.
- I'm excited at hacking away at some new problem, especially when I can't find a solution elsewhere or if someone else's solution doesn't work or feel right.
- I have all kinds of ideas, and my programming todo/to play list isn't intimidating at all.
- I've been able to pick up very old programming or troubleshooting todo items and solve them in an afternoon even when they've been left unsolved for years.
- I don't get the "full brain" issues that I used to. My breaks are more about getting rest for my eyes and mulling ideas in my head than getting frustrated and needing time off from programming.
- I'm not bothered by the "TL;DR" or "wall of text" issues that code used to give me. Just give me syntax highlighting and reasonable indentation (two-space, thanks) and I'm fine. I even like programming with a variable-width font and I can handle not having code folding.
-
I can program with music playing or with other distractions, even ones that take me away from my computer at some length, and it doesn't interrupt me at all.
There are other challenges that I'll be facing, like getting into more complex issues such as arrays/hashes and data in different ways, the more complex math, working with multiple files or poorly-documented libraries. But if this trend continues, I suspect that these things won't be so much of an issue.
Dude. Sweet.
on being analytically-minded ∞
First, some background. I've had a long long history with computers. I've also had a long history of frustration with computers and with most things. I'm one of those grouchy people who always complains about every last thing.
But the thing with my type of grouch is that it's not some kind of hostility or negativity. I bitch and moan when I feel something should have been done better, or could still be done better. I complain because I see hope. I rant because I'm over-optimistic.
I'm extremely analytical and critical. I have an uncanny knack at finding bugs. No, that's not saying it very well. I mean uncanny as in "the Uncanny X-Men", because it's borderline supernatural. I mean having intuition which regularly touches on prescience, and being able to find issues - reproducible and documentable issues - with no effort at all.
Angela Dodson: I've always known where they are. I've always known where to - where to find them, where to - where to aim and where to duck, and I've always known where they were. I've always known that it wasn't luck. Always known that it wasn't luck. I've always known, I've always known that I could see.
On top of that, after having had so much experience with service and support, documentation and teaching, I really do have a foot in both worlds.
John Constantine: These are all Isabel's things?
Angela Dodson: Yeah.
John Constantine: How about the cat?
Angela Dodson: Duck? Yeah, why?
John Constantine: Duck.
Angela Dodson: Oh, you think that's strange.
John Constantine: Cats are good. Half in, half out anyway.
This means that not only do I have an eye for bugs, I have an eye for usability. I'm not just a picky power user, I really do know how an interface can be improved.
not a programmer? ∞
After all of that experience, and all of that desire, and a number of strong attempts.. and even some minor successes, I never could get into programming. It just slid off of my mind. I had issues with inspiration, attention, understanding, memory, etc. I just couldn't do it.
For a long time I had been resolved at never becoming a programmer. I even started funding others to fix software for me.
I can't express how fundamentally frustrating it is for someone to have all kinds of knowledge but no power. It's like being a six year old boy at The Playboy Mansion.
But now it's starting to change.
Last updated 2024-08-12 at 23:55:34