blip

25th October 2016 at 9:12pm
Bash CodeSnippets GitHub ReleasedSoftware TechnicalNotes

Bash Library for Indolent Programmers

Programmers are lazy. Good system administrators are really lazy. (Why bother doing something more than once)?

Unfortunately, due to the fact that Bash doesn't particularly lend itself to reusable code, it doesn't enjoy the same wealth of shared code available that you find with Python or Perl.

"But what about the lazy sysadmin that needs to write a script, where Bash genuinely is the most appropriate option?", I hear you ask! Well, by providing functions for many common tasks, I'm hoping that blip will help fill some of the gaps for those situations.

source /usr/lib/blip.bash

Please see the man page man blip.bash, blip.bash for full documentation or /usr/share/doc/blip directory for code examples and other useful information.

Installation

Ubuntu

On Ubuntu, you can install from my PPA ppa:nicolaw/blip by running the following commands:

sudo add-apt-repository ppa:nicolaw/blip
sudo apt-get update
sudo apt-get install blip

Debian

On Debian or other Debian-based distributions, you can download the DEB package from GitHub and install it manually with:

curl -o https://github.com/neechbear/blip/releases/download/path/to/blip_pkg.deb
sudo dpkg -i blip_pkg.deb

RedHat, CentOS, Fedora

Similarly for RedHat based distributions you can install the RPM package from GitHub manually with:

sudo yum localinstall \
  https://github.com/neechbear/blip/releases/download/path/to/blip_pkg.rpm

Source

Write instructions for installation from GitHub or source tarball here.

TODO

  • Merge all the other cool and reusable stuff I've written in to this library (see pending functionality below).
  • Make all the shell scripting comply with a sensible style guide (like Google's one at https://google.github.io/styleguide/shell.xml).
  • Finish writing comprehensive manual page with code examples for each function.
  • Finish writing comprehensive unit tests with full code coverage.
  • Setup automatic build of release tarballs, Deb and RPM packages upon GitHub repository commits (assuming a Travis CI pass of unit tests).
  • Maybe create pkg, apk and portage packages if I get bored.

Pending Functionality

  • Add get_user_input() - multi character user input without defaults.
  • Add process locking functions.
  • Add background daemonisation functions (ewww; ppl should use systemd).
  • Add standard logging functions.
  • Add syslogging functionality of all process STDOUT + STDERR.
  • Add common array manipulation functions.

See Also

https://github.com/akesterson/cmdarg - A pure bash library to make argument parsing far less troublesome.