Skip to content
A collection of useful bash reusable functions for robust and advanced shell scripts. Used to power cvm and simpli.
Shell Perl
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.


The Offirmo Shell Lib (OSL) is a collection of useful shell functions for robust and advanced shell scripts.

Requirements : I use bash.

Available at :

Note : The OSL has unit tests for maximum quality.


The user story

I found myself having to write a lot of shell scripts, for work and for home.

Over the time, I had to develop a lot of useful functions.

One day, I cleaned them up and packed them in this lib. Enjoy !


The OSL is targeted at bash. Never tested with another shell.


Get a copy of the files and set your path to point to the OSL "bin" dir. You can check if it works by typing :

In your scripts, add this as soon as possible (ideally first instruction in your script for maximum features) :



On demand, source other OSL files as needed :

libs :

  • --> decompress any archive file
  • --> detect version and check capabilities of host OS
  • --> traces
  • --> to abort execution with nice messages
  • --> path manipulations, ensure a line is
  • --> allow output saving and various nice hacks
  • --> create and use mutexes (note : use 'rsrc' wrapper for additional features)
  • --> various display functions : error, warnings...
  • --> safe rsrc manipulation protected by mutex
  • --> shell unit tests, inspired from rspec
  • --> manip of stamp files to detect access time and interferences (note : use 'rsrc' wrapper for additional features)
  • --> string utilities
  • --> UI functions like asking yes or no, pause...
  • --> version comparison utilities (newer/older)
  • --> defines ANSI codes for color

Special files :

  • --> callable, display current OSL version
  • --> various constants

Experimental / in progress :

  • --> exit hook (for mutex auto release)

Env variables : OSL will respond to a few environment variables :

  • OSL_console_has_light_scheme=true (default false) will adjust colored output styles to be more readable on a white background

That's it. You can now use the features.

The functions

For now, look inside the unit tests of the file you're interested in, or look in the file itself.


  • Better doc ;)
  • improve decompression function
  • refactor mutex code to avoid duplication
  • mutex switch from read to write ?
  • forward and aggregate state in rsrc fuctions
  • Make default values redefinable
  • Make it easier to disable color
  • remove "bashisms"
  • asserts ?
  • More...
You can’t perform that action at this time.