sh functions, with unit tests