For those who may be unfamiliar, script is a generalized term referring to a typically small executable file and are supported by a variety of programming languages. Shell environments are a very common introduction to scripting, where a sequence of commands may be aggregated into a single file. Helping with portability, many shells are implemented with POSIX compliance, which means that a shell conforms to a specific set of command requirements. Consequently, scripts written for one POSIX compliant shell (e.x., sh, bash, or zsh) may be executed within any of the others. Scripts are also available in more powerful languages like python, haskell, etc.
The art of implementing effective scripts is an invaluable, yet often understated, skill. They can automate repetitive tasks like building large projects, starting / stopping a complex system, or automating a large sequence of experiments. Their useful in distributed environments to execute a single, simple operation across a collection of machines. And the focus of this series are succinct programs to perform more complex common tasks.
I maintain a scripts repository with a collection of scripts I use on a daily basis. In my system, these are stored in $HOME/bin
which is automatically included in the debian $PATH
. Therefore, on new systems, or after a reinstall, I simply clone this repo and they are all available. I try to keep these programs small, restricting them to a single file with <500 LoC. My collection contains examples to aid dotfile configuration versioning, managing TODO lists with a terminal-based kanban board, switching my UI components between a variety of color themes, and password management among others. To introduce each script with the coverage it deserves I will continuing this script mini-series by exploring a few of the more interesting scripts thereof.
This post is part 1 / 5 of the Script Series:
- Introduction
- A Script for Managing Dotfiles
- Due: A Kanban TODO List Script
- Scripting Your UI Color-Palette
- Password Management with Stash
3 day(s) offloaded in the 100DaysToOffload challenge.