With enough shell, everything is automatic

by debianjoe

2014-09-07-233319_1366x768_scrot

…sid test system x86_64, 257MB of updates behind…

I guess I’ll write something while I wait to see what broke.

While I am by no means a fantastic shell/bash script writer, I will readily admit that I spend a good deal of time playing with creative use of shell scripting.  Scripting in general has been the biggest blessing and curse of my life in userland.  I’ll also readily admit that 90% of the time, I use it to shortcut things that I do on a regular basis.  “Man, instead of me having to set up a 2nd workspace and open the same 3 programs I’m always using in tmux…I could totally make a script for that.”  I would say that this is the lazy man’s path, but I’ve yet to quantify the amount of time saved over the amount of time it takes me to write them.  Could be I’m adding extra work, but that’s not really the point anyhow.

When it starts to get cool is when these little scripts start growing.  “Well, I’d like for this pane to be links2, unless I’ve failed to set up an internet connection, in which case…it should open a second workspace with ceni opened.”  30 minutes later, I’ve now saved no time at all but have managed to run a short ping test to determine which of the two paths should be followed.

Essentially, this is ‘bloat’.  This is MY bloat, though, and I certainly am not forcing it upon anyone else.  I have tons of emacs-lisp bloat too, but it’s all designed to accommodate MY use.  Saving a few hundred keystrokes and possible RSI (emacs and vim users can both laugh here) over the course of my regular use.

As my understanding of shell scripting improves, I find that there is practically no end to how much control the user has over their system with creative use of shell.  I don’t know that it’s necessary, and I’m not interested in debating the merits of one form of scripting over another.  What I would suggest, is that if you’ve failed to do so, write a script that would be useless to anyone except you.  Assuming that you use a floating wm in X, then write one that opens a series of frames with your favorite programs open in them using perfectly balanced geometry.  If you use a terminal multiplexer, then write a script to lay out your most common working environment.  The point is not the specifics, but rather that once you start to use it, that you’ll begin to have little creative ideas about how you could make it slightly more efficient (or, at least I have these thoughts, and so I assume everyone else will.)

As you begin to implement little tweaks, you’ll run into snags and setbacks where things don’t work “quite” like you meant for them to.  This is expected, and in the end, while your application of scripting may not be useful…your ability to control variables on your own personal system and to troubleshoot will drastically improve.  I’m sure there are scripting pros out there that don’t need any of this, and that’s cool…you guys just keep doing what you do.  For the rest of us, practice leads to consistent improvement.

Advertisements