Bash Scripting for Buffoons

Ceri Shaw
12/16/15 04:11:49AM

or How I Learned to Love The Command Line

Firstly let me say that I am a keen supporter of the 'Ubuntification' ( see footnote ) of Linux. I use Ubuntu both on the desktop and on the server and if Linux is ever to conquer the desktop a user-friendly GUI is an essential prerequisite. But recently I have become more irritated by proponents of the GUI versus the command line in computing. The GUI is a place of drudgery, where you go to perform routine tasks with the minimum of thought and concentration. The command line on the other hand is a place of enchantment where you go in order to master a new and powerful tongue which will ultimately allow you to accomplish much, much more . Anyone who dismisses it as an anachronism is either a fool or just plain computer illiterate.

The GUI inhibits creativity by encouraging over-reliance on software ( often proprietary ) which offers only a limited subset of the capabilities of the underlying markup or scripting languages. How often have you heard someone say "Oh I can only do that in Dreamweaver." But, of course, Dreamweaver is nothing more than a brightly colored box with gaudy labels all over it. Webpages are made out of html, css, javascript, flash etc. not GUI buttons. People talk about the irreplacability of productivity software like 'Excel' in which case they might be interested in the following comment from a recent article ( which can be found here )

“you probably don’t see a business user crunching their data in the terminal, do you?”

YES. Our organization use to do all of our monthly reports in Excel. It took nearly two weeks to compile, aggregate, format and print all of them. We now do everything from a BASH script. It’s scheduled as a Cron job that executes during the night when our offices are closed, takes about 15min. to run, and all of the reports are sitting on the printer when we open.

My point is that no matter how creative or productive you are or wish to be you cannot afford to ignore the Bash shell. Once mastered it vastly increases productivity and encourages a whole new way of thinking and self-expression.

Personally, I refuse to learn anything other than by example. My thought processes are far too erratic for logical exposition. But if Bash is a language then it is possible to look upon scripting as an art form. I havent composed any sonnets yet ( mostly limericks so far ) but I live in hope. Ultimately it doesn't matter how much of a disorganised shambles you are, you can still express yourself in Bash.

In conclusion, for the esoteric ones, I have included a link to some scripts of my own below. These scripts are provided for purposes of entertainment and perhaps edification. Beware...this way madness lies!

Footnote:- It seems that my employment of the term 'Ubuntification' occasioned some confusion. However, a public spirited contributor to the Dunedin Linux Users Group in new Zealand offers an interesting definition of the term in this post.

The scripts below are organised into three sub-categories:-

Marginally Useful

Eggtimer Script

Snapshot Script

Of Dubious Usefulness

Bills Script

Quick Hide

Completely Bloody Useless

Finder Script

NoName Script

My purpose in presenting them is twofold. Firstly it is hoped that they will amuse persons who have adequately mastered the art of shell-scripting. The sheer fumbling inelegance of some of the 'solutions' on offer is vaguely reminiscent of Rube Goldberg ( or Heath Robinson ). They are also offered as a resource for the novice shell scripter who may be able to cannibalise pieces of the code and put them to a truly useful purpose. There is a brief guide to making scripts executable on this page and a list of bash scripting resources here.