Striving for greatness

The life and times of a Gentoo developer and leader

Bash shell-scripting libraries

One of the most powerful aspects of popular high-level languages is the existence of a comprehensive standard library. Unfortunately, the most popular Linux shell, bash, lacks a full-featured library bundled with it. A number of people have written libraries to compensate for this lack, which can make your life infinitely easier if you need to write complex bash scripts. Here are links to all the bash/shell-scripting libraries and collections I’m aware of:

It was a real pain to come up with this whole list, so hopefully it’s useful to some of you. In future posts, I’m thinking of reviewing these libraries in more depth and comparing them to equivalent functionality in Python, my other language of choice. My goal is not to have functionality re-implemented in shell script to replace basic tools like head/tail, but instead to discover or create (if necessary) a library using the full suite of standard UNIX tools to provide a fun and convenient experience for shell scripters.

Update (2013/07/08): Added rerun.

Update: Fixed a couple of broken links (bashworks and Portable Shell).

About these ads

Written by Donnie Berkholz

April 7, 2011 at 10:59 pm

Posted in Blog

Tagged with ,

13 Responses

Subscribe to comments with RSS.

  1. I’m maintaining libui-sh, I UI-abstraction framework for bash (supporting both cli and ncurses through dialog)

    https://github.com/Dieterbe/libui-sh

    Dieter_be

    April 8, 2011 at 2:54 am

  2. A full featured standard library could probably come out of portage.

    nico

    April 8, 2011 at 4:07 am

  3. Although its not a bash framework, I have created a modular bash script called monkey tail which can merge and unmerge code into itself.

    http://www.github.com/lmartinking/monkey-tail

    Lucas Martin-King

    April 8, 2011 at 9:08 am

  4. Dude would be nice to have a comparison among those! :D

    deadhead

    April 8, 2011 at 9:56 am

  5. Pretty awsome list! Thanks for sharing it! +1 on some description/comparison of the libraries.

    Pavel

    April 9, 2011 at 4:13 am

  6. Nice list you made, some I’m familiar with, others are new to me. I’m the person messing around with BSFL. This is still a work in progress and may not serve all needs, but I hope someone may find a use for it.

    BSFL is not for advanced stuff, but provides basic functionality to make your shell scripts more human friendly regarding output (status messages, logging, etc) but it is not limited to this.

    If people have any ideas/suggestions about what they certainly would want from a bash library, please tell me.

    Louwrentius

    April 9, 2011 at 4:43 pm

  7. [...] Bash shell-scripting libraries [...]

  8. Friend of mine did this:

    http://sourceforge.net/projects/oobash/

    mainly object oriented string operations, java-python style

    Sebastian

    April 11, 2011 at 6:39 am

  9. Thanks for this list! I’m a big fan of using shell functions myself, that’s why I wrote app-shells/prll. It’s meant to parallelize shell functions.

    http://sourceforge.net/projects/prll/

    exzombie

    April 14, 2011 at 1:08 pm

  10. Another me too for the comparison.

    Having programmed bash for 20 years now, I _do_ believe that if your bash code becomes too complex and large, its a sign that you should rewrite into another language. Unless bash is written particularly cleanly (“set -e”, only “local” variables, clean STDOUT/STDERR handling, …) it is hard to read and maintain large bash scripts. And they can be slow besides.

    In that way it’s similar to make: if your Makefile becomes too complicated, it’s a sign you are trying to be too complex for the language.

    Hans

    April 29, 2011 at 10:02 am

  11. While I generally do agree that overly complex apps should not be written in bash, there are times when this may not be so easily avoidable. Other times things only seem complex. Having library that makes scripting easier is definitely a good thing.

    Consider adding BLIB -> http://bit.ly/i7tZWH to your list.

    Cheers,
    @MikelKing

    Mikel King

    May 27, 2011 at 12:35 pm

  12. [...] Bash shell-scripting libraries ” Striving for greatness (dberkholz.com) [...]


Comments are closed.

Follow

Get every new post delivered to your Inbox.

Join 36 other followers

%d bloggers like this: