b4sh-l1b aka bash-lib aka bash library

A library that solves some common problems and redefiines missing functions.

Overview

repository url: https://gitlab.com/b4sh-stack/b4sh-l1b/

Many common situations end soon on systems that are not GNU/UNIX compatible e.g. busybox is lacking many functions like tac / rev , even iproute standards like tun are mising in default openwrt builds

The project solves lots of problems:

  • missing tools like tac , nl, rev are defined
  • deduplication of STDIN
  • timestamps in nanosecond even when host does not provide it(openwrt/busybox)
  • docker functions
  • git tools for automatic pushing/committing
  • ipv4/ipv6 checks
  • etc

References:

Index

_quote_single()

wrap a string in single quotes

Example

echo some string |_quote_single

See also

_quote_double()

wrap a string in double quotes

Example

echo some string |_quote_double

See also

_dedup_sort()

sort and deduplicate file or STDIN

Example

cat /tmp/anyfile|_dedup_sort
_dedup_sort /tmp/file1 /tmp/file2

Arguments

  • (filename): one or multiple files to sort

Output on stdout

  • a sorted and deduplicated result will be printed to STDOUT

See also

_dedup()

deduplicate STDIN

Example

cat /tmp/anyfile|_dedup_sort

Arguments

  • (this): function has no arguments

Output on stdout

  • a deduplicated result will be printed to STDOUT

See also

_oneline()

remove newlines from STDIN

Example

cat /tmp/anyfile|_dedup_sort

Arguments

  • (this): function has no arguments

Output on stdout

  • a deduplicated result will be printed to STDOUT

See also