{"id":25694293,"url":"https://github.com/rdavid/shellbase","last_synced_at":"2026-04-04T01:03:38.020Z","repository":{"id":55339335,"uuid":"323930496","full_name":"rdavid/shellbase","owner":"rdavid","description":"The framework is specifically designed for Unix shell scripts.","archived":false,"fork":false,"pushed_at":"2026-04-01T23:07:29.000Z","size":1023,"stargazers_count":8,"open_issues_count":2,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2026-04-02T09:26:09.998Z","etag":null,"topics":["container","docker","linux","podman","posix","redo","shell","unix"],"latest_commit_sha":null,"homepage":"","language":"Shell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"0bsd","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/rdavid.png","metadata":{"files":{"readme":"README.adoc","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":"AGENTS.md","dco":null,"cla":null}},"created_at":"2020-12-23T14:58:55.000Z","updated_at":"2026-04-01T23:07:33.000Z","dependencies_parsed_at":"2026-01-15T00:01:49.539Z","dependency_job_id":null,"html_url":"https://github.com/rdavid/shellbase","commit_stats":null,"previous_names":[],"tags_count":34,"template":false,"template_full_name":null,"purl":"pkg:github/rdavid/shellbase","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rdavid%2Fshellbase","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rdavid%2Fshellbase/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rdavid%2Fshellbase/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rdavid%2Fshellbase/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/rdavid","download_url":"https://codeload.github.com/rdavid/shellbase/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rdavid%2Fshellbase/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31383636,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-03T23:20:52.058Z","status":"ssl_error","status_checked_at":"2026-04-03T23:20:51.675Z","response_time":107,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["container","docker","linux","podman","posix","redo","shell","unix"],"created_at":"2025-02-24T23:52:04.816Z","updated_at":"2026-04-04T01:03:38.005Z","avatar_url":"https://github.com/rdavid.png","language":"Shell","funding_links":[],"categories":[],"sub_categories":[],"readme":"// Settings:\n:toc: macro\n:!toc-title:\n// URLs:\n:img-hoc: https://hitsofcode.com/github/rdavid/shellbase?branch=master\u0026label=hits%20of%20code\n:img-license: https://img.shields.io/github/license/rdavid/shellbase?color=blue\u0026labelColor=gray\u0026logo=freebsd\u0026logoColor=lightgray\u0026style=flat\n:img-releases: https://img.shields.io/github/v/release/rdavid/shellbase?color=blue\u0026label=%20\u0026logo=semver\u0026logoColor=white\u0026style=flat\n:img-test-bsd: https://github.com/rdavid/shellbase/actions/workflows/test-bsd.yml/badge.svg\n:img-test-lnx: https://github.com/rdavid/shellbase/actions/workflows/test-lnx.yml/badge.svg\n:img-test-mac: https://github.com/rdavid/shellbase/actions/workflows/test-mac.yml/badge.svg\n:url-actionlint: https://github.com/rhysd/actionlint\n:url-base: https://github.com/rdavid/shellbase/blob/master/lib/base.sh\n:url-checkmake: https://github.com/mrtazz/checkmake\n:url-cv: http://cv.rabkin.co.il\n:url-dotfiles: https://github.com/rdavid/dotfiles\n:url-gento: https://github.com/rdavid/gento\n:url-goredo: http://www.goredo.cypherpunks.su/INSTALL.html\n:url-goredoer: https://github.com/rdavid/goredoer\n:url-hadolint: https://github.com/hadolint/hadolint\n:url-hoc: https://hitsofcode.com/view/github/rdavid/shellbase?branch=master\n:url-license: https://github.com/rdavid/shellbase/blob/master/LICENSES/0BSD.txt\n:url-pulse: https://github.com/rdavid/pulse\n:url-redo: http://cr.yp.to/redo.html\n:url-releases: https://github.com/rdavid/shellbase/releases\n:url-reuse: https://github.com/fsfe/reuse-action\n:url-sh0: https://mywiki.wooledge.org/BashPitfalls\n:url-sh1: http://www.etalabs.net/sh_tricks.html\n:url-sh2: https://mywiki.wooledge.org/SignalTrap\n:url-sh3: https://www.grymoire.com/Unix/Sh.html\n:url-shellcheck: https://github.com/koalaman/shellcheck\n:url-shfmt: https://github.com/mvdan/sh\n:url-test-bsd: https://github.com/rdavid/shellbase/actions/workflows/test-bsd.yml\n:url-test-lnx: https://github.com/rdavid/shellbase/actions/workflows/test-lnx.yml\n:url-test-mac: https://github.com/rdavid/shellbase/actions/workflows/test-mac.yml\n:url-toolbox: https://github.com/rdavid/toolbox\n:url-typos: https://github.com/crate-ci/typos\n:url-vale: https://vale.sh\n:url-yamllint: https://github.com/adrienverge/yamllint\n\n= Shellbase\n\n// The width is set to 79 characters, and the height is 8 lines. An ASCII art\n// generator is used with the specific font Georgia 11 by Richard Sabey\n// \u003ccryptic_fan@hotmail.com\u003e 9.2003:\n//  http://patorjk.com/software/taag/#p=display\u0026f=Georgia11\u0026t=shellbase\n[,sh]\n----\n             ,,                 ,,    ,,  ,,                                  \n           `7MM               `7MM  `7MM *MM                                  \n             MM                 MM    MM  MM                                  \n    ,pP\"Ybd  MMpMMMb.  .gP\"Ya   MM    MM  MM,dMMb.   ,6\"Yb.  ,pP\"Ybd  .gP\"Ya  \n    8I   `\"  MM    MM ,M'   Yb  MM    MM  MM    `Mb 8)   MM  8I   `\" ,M'   Yb \n    `YMMMa.  MM    MM 8M\"\"\"\"\"\"  MM    MM  MM     M8  ,pm9MM  `YMMMa. 8M\"\"\"\"\"\" \n    L.   I8  MM    MM YM.    ,  MM    MM  MM.   ,M9 8M   MM  L.   I8 YM.    , \n    M9mmmP'.JMML  JMML.`Mbmmd'.JMML..JMML.P^YbmdP'  `Moo9^Yo.M9mmmP'  `Mbmmd' \n----\n\nimage:{img-test-bsd}[text bsd,link={url-test-bsd}]\nimage:{img-test-lnx}[text lnx,link={url-test-lnx}]\nimage:{img-test-mac}[test mac,link={url-test-mac}]\nimage:{img-hoc}[hits of code,link={url-hoc}]\nimage:{img-releases}[release,link={url-releases}]\nimage:{img-license}[license,link={url-license}]\n\ntoc::[]\n\n== About\n\nThe `shellbase` framework serves as a foundation for Unix shell scripts.\nIt is mostly POSIX-compliant (`Portable Operating System Interface for uniX`),\nwhich helps keep it compatible across Unix-like systems.\nIt offers essential services, including logging, validation helpers, signal\nhandling, garbage collection, and support for multiple instances.\n\n`shellbase` defines global variables and functions.\nAll functions without the `base_` prefix are public and can be used by clients.\nThe public functions are, in alphabetical order:\n{url-base}#L54[`aud_only`],\n{url-base}#L98[`beroot`],\n{url-base}#L103[`beuser`],\n{url-base}#L114[`bomb`],\n{url-base}#L120[`cheat`],\n{url-base}#L132[`cmd_exists`],\n{url-base}#L165[`chrono_get`],\n{url-base}#L205[`chrono_sta`],\n{url-base}#L216[`chrono_sto`],\n{url-base}#L226[`cya`],\n{url-base}#L236[`die`],\n{url-base}#L246[`dng2jpg`],\n{url-base}#L252[`echo`],\n{url-base}#L274[`ellipsize`],\n{url-base}#L292[`file_exists`],\n{url-base}#L301[`gitlog`],\n{url-base}#L325[`grbt`],\n{url-base}#L337[`handle_pipefails`],\n{url-base}#L343[`heic2jpg`],\n{url-base}#L356[`inside`],\n{url-base}#L363[`isempty`],\n{url-base}#L387[`isfunc`],\n{url-base}#L400[`isnumber`],\n{url-base}#L408[`isreadable`],\n{url-base}#L417[`isroot`],\n{url-base}#L429[`issolid`],\n{url-base}#L463[`iswritable`],\n{url-base}#L477[`log`],\n{url-base}#L486[`loge`],\n{url-base}#L494[`logw`],\n{url-base}#L503[`map_del`],\n{url-base}#L523[`map_get`],\n{url-base}#L545[`map_put`],\n{url-base}#L557[`nmea2gpx`],\n{url-base}#L576[`pdf2jpg`],\n{url-base}#L581[`pdf2png`],\n{url-base}#L600[`prettytable`],\n{url-base}#L626[`prettyuptime`],\n{url-base}#L649[`realdir`],\n{url-base}#L658[`realpath`],\n{url-base}#L671[`semver`],\n{url-base}#L689[`should_continue`],\n{url-base}#L745[`timestamp`],\n{url-base}#L765[`tolog`],\n{url-base}#L771[`tologe`],\n{url-base}#L778[`tolower`],\n{url-base}#L796[`totsout`],\n{url-base}#L802[`tsout`],\n{url-base}#L810[`url_exists`],\n{url-base}#L834[`user_exists`],\n{url-base}#L850[`validate_cmd`],\n{url-base}#L857[`validate_var`],\n{url-base}#L864[`var_exists`],\n{url-base}#L898[`ver_ge`],\n{url-base}#L906[`vid2aud`],\n{url-base}#L920[`ytda`].\n\nGlobal variables have the `BASE_` prefix and can be used by clients.\nClients should place temporary files under `$BASE_WIP`.\nAll functions starting with the `base_` prefix are internal and should not be\nused by clients.\nNames are listed in alphabetical order.\n\nSee\n{url-dotfiles}[`dotfiles`],\n{url-gento}[`gento`],\n{url-pulse}[`pulse`], and\n{url-toolbox}[`toolbox`]\nas example projects that use this framework.\n\n== Install\n\nThe artifact is a single non-executable POSIX-compliant shell script file\n{url-base}[`base.sh`].\nInstall the file from the repository:\n\n[,sh]\n----\ngit clone git@github.com:rdavid/shellbase.git \u0026\u0026\n  ./shellbase/app/install\n----\n\nInstall the file from a release.\nSome operating systems demand administrative rights to install to\n`/usr/local/bin`; use `sudo` or `doas` before `tar`:\n\n[,sh]\n----\nREL=0.9.20260404\nSRC=https://github.com/rdavid/shellbase/archive/refs/tags/v$REL.tar.gz\ncurl --location --silent $SRC |\n  tar \\\n    --directory /usr/local/bin \\\n    --extract \\\n    --gzip \\\n    --strip-components=2 \\\n    shellbase-$REL/lib/base.sh\n----\n\n== Using\n\nVerify `/usr/local/bin` is in your `PATH`.\nThen your script can use `shellbase`:\n\n[,sh]\n----\n#!/bin/sh\n# shellcheck disable=SC1091 # File not following.\n. base.sh\nlog I\\'m using the shellbase.\n----\n\nYou can try `shellbase` without installation:\n\n[,sh]\n----\n#!/bin/sh\nREL=0.9.20260404\nSRC=https://github.com/rdavid/shellbase/archive/refs/tags/v$REL.tar.gz\neval \"$(\n  curl --location --silent $SRC |\n    tar \\\n      --extract \\\n      --gzip \\\n      --to-stdout \\\n      shellbase-$REL/lib/base.sh\n)\"\nlog I\\'m using the shellbase.\n----\n\n{url-base}#L600[`prettytable`] example:\n\n[,sh]\n----\n. base.sh\n{\n  printf 'ID\\tNAME\\tTITLE\\n'\n  printf '123456789\\tJohn Foo\\tDirector\\n'\n  printf '12\\tMike Bar\\tEngineer\\n'\n} | prettytable\n----\n\nOutput:\n\n[,sh]\n----\n+-----------+----------+----------+\n|ID         |NAME      |TITLE     |\n+-----------+----------+----------+\n|123456789  |John Foo  |Director  |\n|12         |Mike Bar  |Engineer  |\n+-----------+----------+----------+\n----\n\n== Test\n\nThe project uses Daniel J. Bernstein's build system, {url-redo}[`redo`].\nYou can install Sergey Matveev's {url-goredo}[`goredo`] implementation.\n`redo lint` applies the following linters to the source files:\n{url-actionlint}[`actionlint`],\n{url-checkmake}[`checkmake`],\n{url-hadolint}[`hadolint`],\n{url-reuse}[`reuse`],\n{url-shellcheck}[`shellcheck`],\n{url-shfmt}[`shfmt`],\n{url-typos}[`typos`],\n{url-vale}[`vale`],\n{url-yamllint}[`yamllint`].\n`redo test` runs unit tests across installed shells.\n`redo test-container` runs the tests across various shells in containers.\nThe project uses {url-cv}[David Rabkin]'s {url-goredoer}[`goredoer`] to build\n{url-goredo}[`goredo`].\n\n== Links\n\n- {url-sh0}[Bash Pitfalls]\n- {url-sh1}[Rich’s sh (POSIX shell) tricks]\n- {url-sh2}[Sending and Trapping Signals]\n- {url-sh3}[Sh - the POSIX Shell]\n\n== License\n\n`shellbase` is copyright {url-cv}[David Rabkin] and available under a\n{url-license}[Zero-Clause BSD license].\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frdavid%2Fshellbase","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frdavid%2Fshellbase","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frdavid%2Fshellbase/lists"}