Giter Site home page Giter Site logo

shlib's Introduction

shlib

portable functions for posix shell environments

Build Status

I've sadly written a lot of shell scripts. Mostly for installers on completely alien environments.

Really shell code should only be used for boot-strapping to something sane. Until then you might need some truly portable functions. I hope you never need to use them, but if you do they are public domain. Do whatever you'd like with them.

However acknowledgement (and pull requests) are appreciated. You can optionally include license.sh so the next person knows where to find them.

Usage

Here's an example of how create and compress a custom set of functions. Using grep -v '^#' | grep -v ' #' | tr -s '\n' strips away comments and blank lines.

cat \
  license.sh \
  is_command.sh \
  uname.sh \
  untar.sh \
  mktmpdir.sh \
  http_download.sh \
  hash_sha256.sh \
  license_end.sh | \
  grep -v '^#' | grep -v ' #' | tr -s '\n'

WIP

Some of these are new, some are these are pulled from old code I wrote. All can definitely be improved. Pull requests very welcome:

  • Simplify
  • Clean up local variable use
  • Remove any "exit 1" I may have left behind

Testing

I'm unlikely to work on this in the short term, but.. someone, someday could:

  • Probably write the test harness in go, not shell.
  • Using travis.ci we can definite test ubuntu, centos and alpine/busybox using docker
  • Can we test macOS on travis? They support something here but unclear how it works.

Documentation

I've start to write doco in Markdown as shell comments. The plan would be to extract it to standalone markdown so it would display on GitHub.

shlib's People

Contributors

client9 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.