{"id":20227439,"url":"https://github.com/fkemser/shlib","last_synced_at":"2026-05-10T13:10:32.144Z","repository":{"id":244296759,"uuid":"746358370","full_name":"fkemser/SHlib","owner":"fkemser","description":"A (mostly) POSIX-/Bourne-Shell(sh)-compliant function library.","archived":false,"fork":false,"pushed_at":"2024-10-29T14:07:43.000Z","size":326,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-01-13T23:40:44.601Z","etag":null,"topics":["bash","library","posix","sh","shell"],"latest_commit_sha":null,"homepage":"","language":"Shell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"lgpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/fkemser.png","metadata":{"files":{"readme":"README.md","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}},"created_at":"2024-01-21T20:17:43.000Z","updated_at":"2024-10-29T14:07:49.000Z","dependencies_parsed_at":"2024-10-29T15:40:30.566Z","dependency_job_id":null,"html_url":"https://github.com/fkemser/SHlib","commit_stats":null,"previous_names":["fkemser/shlib"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fkemser%2FSHlib","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fkemser%2FSHlib/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fkemser%2FSHlib/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fkemser%2FSHlib/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/fkemser","download_url":"https://codeload.github.com/fkemser/SHlib/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":241670155,"owners_count":20000327,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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":["bash","library","posix","sh","shell"],"created_at":"2024-11-14T07:24:48.255Z","updated_at":"2026-05-10T13:10:32.118Z","avatar_url":"https://github.com/fkemser.png","language":"Shell","funding_links":[],"categories":[],"sub_categories":[],"readme":"\r\n\u003c!-- Improved compatibility of back to top link: See: https://github.com/othneildrew/Best-README-Template/pull/73 --\u003e\r\n\u003ca name=\"readme-top\"\u003e\u003c/a\u003e\r\n\u003c!--\r\n*** Thanks for checking out the Best-README-Template. If you have a suggestion\r\n*** that would make this better, please fork the repo and create a pull request\r\n*** or simply open an issue with the tag \"enhancement\".\r\n*** Don't forget to give the project a star!\r\n*** Thanks again! Now go create something AMAZING! :D\r\n--\u003e\r\n\r\n\r\n\r\n\u003c!-- PROJECT SHIELDS --\u003e\r\n\u003c!--\r\n*** I'm using markdown \"reference style\" links for readability.\r\n*** Reference links are enclosed in brackets [ ] instead of parentheses ( ).\r\n*** See the bottom of this document for the declaration of the reference variables\r\n*** for contributors-url, forks-url, etc. This is an optional, concise syntax you may use.\r\n*** https://www.markdownguide.org/basic-syntax/#reference-style-links\r\n--\u003e\r\n[![Contributors][contributors-shield]][contributors-url]\r\n[![Forks][forks-shield]][forks-url]\r\n[![Stargazers][stars-shield]][stars-url]\r\n[![Issues][issues-shield]][issues-url]\r\n[![GNU GPL v3.0 License][license-shield]][license-url]\r\n\u003c!-- [![LinkedIn][linkedin-shield]][linkedin-url] --\u003e\r\n\r\n\r\n\r\n\u003c!-- PROJECT LOGO --\u003e\r\n\u003cbr /\u003e\r\n\u003cdiv align=\"center\"\u003e\r\n  \u003c!-- \u003ca href=\"https://github.com/fkemser/SHlib\"\u003e\r\n    \u003cimg src=\"images/logo.png\" alt=\"Logo\" width=\"80\" height=\"80\"\u003e\r\n  \u003c/a\u003e --\u003e\r\n\r\n\u003ch3 align=\"center\"\u003eSHlib\u003c/h3\u003e\r\n\r\n  \u003cp align=\"center\"\u003e\r\n    A collection of (mostly) POSIX-compliant functions to extend Bourne-Shell (sh) functionality.\r\n    \u003cbr /\u003e\r\n    \u003ca href=\"https://github.com/fkemser/SHlib\"\u003e\u003cstrong\u003eExplore the docs »\u003c/strong\u003e\u003c/a\u003e\r\n    \u003cbr /\u003e\r\n    \u003cbr /\u003e\r\n    \u003ca href=\"https://github.com/fkemser/SHlib\"\u003eView Demo\u003c/a\u003e\r\n    ·\r\n    \u003ca href=\"https://github.com/fkemser/SHlib/issues\"\u003eReport Bug\u003c/a\u003e\r\n    ·\r\n    \u003ca href=\"https://github.com/fkemser/SHlib/issues\"\u003eRequest Feature\u003c/a\u003e\r\n  \u003c/p\u003e\r\n\u003c/div\u003e\r\n\r\n\r\n\r\n\u003c!-- TABLE OF CONTENTS --\u003e\r\n\u003cdetails open\u003e\r\n  \u003csummary\u003eTable of Contents\u003c/summary\u003e\r\n  \u003col\u003e\r\n    \u003cli\u003e\r\n      \u003ca href=\"#about-the-project\"\u003eAbout The Project\u003c/a\u003e\r\n      \u003cul\u003e\r\n        \u003cli\u003e\u003ca href=\"#built-with\"\u003eBuilt With\u003c/a\u003e\u003c/li\u003e\r\n        \u003cli\u003e\u003ca href=\"#testing-environment\"\u003eTesting Environment\u003c/a\u003e\u003c/li\u003e\r\n      \u003c/ul\u003e\r\n    \u003c/li\u003e\r\n    \u003cli\u003e\r\n      \u003ca href=\"#prerequisites\"\u003e\u003cb\u003ePrerequisites\u003c/b\u003e\u003c/a\u003e\r\n      \u003cul\u003e\r\n        \u003cli\u003e\u003ca href=\"#debian\"\u003eDebian\u003c/a\u003e\u003c/li\u003e\r\n      \u003c/ul\u003e\r\n    \u003c/li\u003e\r\n    \u003cli\u003e\u003ca href=\"#installation\"\u003e\u003cb\u003eInstallation\u003c/b\u003e\u003c/a\u003e\u003c/li\u003e\r\n    \u003cli\u003e\r\n      \u003ca href=\"#documentation\"\u003e\u003cb\u003eDocumentation\u003c/b\u003e\u003c/a\u003e\r\n      \u003cul\u003e\r\n        \u003cli\u003e\u003ca href=\"#clibsh\"\u003ec.lib.sh\u003c/a\u003e\u003c/li\u003e\r\n        \u003cli\u003e\u003ca href=\"#corelibsh\"\u003ecore.lib.sh\u003c/a\u003e\u003c/li\u003e\r\n        \u003cli\u003e\u003ca href=\"#iperf3libsh\"\u003eiperf3.lib.sh\u003c/a\u003e\u003c/li\u003e\r\n        \u003cli\u003e\u003ca href=\"#mathlibsh\"\u003emath.lib.sh\u003c/a\u003e\u003c/li\u003e\r\n        \u003cli\u003e\u003ca href=\"#msglibsh\"\u003emsg.lib.sh\u003c/a\u003e\u003c/li\u003e\r\n        \u003cli\u003e\u003ca href=\"#netlibsh\"\u003enet.lib.sh\u003c/a\u003e\u003c/li\u003e\r\n        \u003cli\u003e\u003ca href=\"#nmlibsh\"\u003enm.lib.sh\u003c/a\u003e\u003c/li\u003e\r\n        \u003cli\u003e\u003ca href=\"#openwrtlibsh\"\u003eopenwrt.lib.sh\u003c/a\u003e\u003c/li\u003e\r\n        \u003cli\u003e\u003ca href=\"#oslibsh\"\u003eos.lib.sh\u003c/a\u003e\u003c/li\u003e\r\n        \u003cli\u003e\u003ca href=\"#tcpdumplibsh\"\u003etcpdump.lib.sh\u003c/a\u003e\u003c/li\u003e\r\n      \u003c/ul\u003e\r\n    \u003c/li\u003e\r\n    \u003cli\u003e\u003ca href=\"#roadmap\"\u003eRoadmap\u003c/a\u003e\u003c/li\u003e\r\n    \u003cli\u003e\u003ca href=\"#contributing\"\u003eContributing\u003c/a\u003e\u003c/li\u003e\r\n    \u003cli\u003e\u003ca href=\"#license\"\u003eLicense\u003c/a\u003e\u003c/li\u003e\r\n    \u003cli\u003e\u003ca href=\"#contact\"\u003eContact\u003c/a\u003e\u003c/li\u003e\r\n    \u003cli\u003e\u003ca href=\"#acknowledgments\"\u003eAcknowledgments\u003c/a\u003e\u003c/li\u003e\r\n  \u003c/ol\u003e\r\n\u003c/details\u003e\r\n\r\n\r\n\r\n\u003c!-- ABOUT THE PROJECT --\u003e\r\n## About The Project\r\n\r\nAfter developing several shell scripts it was time to gather recurring code patterns and store them in a library. The goal of this project is to provide a (mostly) POSIX-/Bourne-Shell(sh)-compliant library that provides\r\n\r\n- essential functions, such as\r\n  - checking the existence of a command/directory/file,\r\n  - converting/modifying variables,\r\n  - string manipulation,\r\n\r\n- logging and output formatting functions, such as\r\n  - system logging,\r\n  - formatting terminal messages,\r\n  - providing message templates, e.g. license notification,\r\n\r\n- mathematical functions and operations, such as\r\n  - advanced calculation using `bc`\r\n    (supporting floating point numbers),\r\n  - converting units, e.g. from 'MB' into 'GB',\r\n  - checking if a number is within a specified range,\r\n  - functions like `abs` or `sign`,\r\n\r\n- network related functions, such as\r\n  - changing an interface's IP address,\r\n  - retrieving interface statistics,\r\n  - creating/removing bridges,\r\n  - performing DNS lookups,\r\n\r\n- OS-related functions, such as\r\n  - retrieving CPU/RAM information,\r\n  - process-related tasks,\r\n  - modifying bootloader settings, or\r\n  - SSH/SCP wrapper,\r\n\r\n- regular expression tests, e.g.\r\n  - data types (boolean, float, hexadecimal, integer),\r\n  - network-related (DNS, ICMP, IPv4/6, MAC, TCP, UDP), and\r\n  - application-specific (CUPS, IPset, LUKS, etc.)\r\n\r\n- special tool-related functions, e.g. for\r\n  - iperf3,\r\n  - NetworkManager,\r\n  - OpenWRT,\r\n  - Tcpdump,\r\n\r\n- and much more.\r\n\r\n\u003cp align=\"right\"\u003e(\u003ca href=\"#readme-top\"\u003eback to top\u003c/a\u003e)\u003c/p\u003e\r\n\r\n\r\n\r\n### Built With\r\n\r\n[![Shell Script][Shell Script-shield]][Shell Script-url]\r\n\r\n\u003cp align=\"right\"\u003e(\u003ca href=\"#readme-top\"\u003eback to top\u003c/a\u003e)\u003c/p\u003e\r\n\r\n\r\n\r\n### Testing Environment\r\n\r\nThe project has been developed and tested on the following system:\r\n\r\n| Info | Description\r\n---: | ---\r\nOS | Debian GNU/Linux 12 (bookworm)\r\nKernel | 5.15.133.1-microsoft-standard-WSL2\r\nPackages | [bc (1.07.1-3+b1)](https://packages.debian.org/bookworm/bc)\r\n|| [bind9-dnsutils (1:9.18.19-1~deb12u1)](https://packages.debian.org/bookworm/bind9-dnsutils)\r\n|| [coreutils (9.1-1)](https://packages.debian.org/bookworm/coreutils)\r\n|| [dash (0.5.12-2)](https://packages.debian.org/bookworm/dash)\r\n|| [dialog (1.3-20230209-1)](https://packages.debian.org/bookworm/dialog)\r\n|| [iproute2 (6.1.0-3)](https://packages.debian.org/bookworm/iproute2)\r\n|| [libc-bin (2.36-9+deb12u3)](https://packages.debian.org/bookworm/libc-bin)\r\n|| [netcat (1.10-46)](https://packages.debian.org/bookworm/netcat)\r\n|| [network-manager (1.42.4-1)](https://packages.debian.org/bookworm/network-manager)\r\n|| [sudo (1.9.13p3-1+deb12u1)](https://packages.debian.org/bookworm/sudo)\r\n|| [udev (252.19-1~deb12u1)](https://packages.debian.org/bookworm/udev)\r\n\r\n\u003e :information_source: Most of the packages are optional and only needed for certain library functions.\r\n\r\n\u003cp align=\"right\"\u003e(\u003ca href=\"#readme-top\"\u003eback to top\u003c/a\u003e)\u003c/p\u003e\r\n\r\n\r\n\r\n\u003c!-- PREREQUISITES --\u003e\r\n## Prerequisites\r\n\r\nPlease make sure that the following dependencies are installed:\r\n\r\n* POSIX-/Bourne-compliant shell\r\n* Additional packages (only needed for certain functions, see [Testing Environment](#testing-environment))\r\n\r\nBelow you can find distribution-specific installation instructions (only needed for additional packages).\r\n\r\n### Alpine Linux\r\n```sh\r\napk add bc bind-tools coreutils dialog iproute2 netcat-openbsd networkmanager-cli sudo\r\n```\r\n\r\n### Debian\r\n\r\n```sh\r\napt install bc bind9-dnsutils coreutils dash dialog iproute2 libc-bin netcat network-manager sudo udev\r\n```\r\n\r\n\u003cp align=\"right\"\u003e(\u003ca href=\"#readme-top\"\u003eback to top\u003c/a\u003e)\u003c/p\u003e\r\n\r\n\r\n\r\n\u003c!-- INSTALLATION--\u003e\r\n## Installation\r\n\r\n1. Change into the root folder of a (local) repo that will use the library.\r\n2. Add this repo as a submodule:\r\n\t```sh\r\n   git submodule add https://github.com/fkemser/SHlib lib/SHlib\r\n   ```\r\n3. To source (use) the library within your project simply put the following code at the beginning of your script:\r\n\r\n    ```sh\r\n    # Get current working direcotry\r\n    readonly CWD=\"$( cd \"$(dirname \"$0\")\" \u003e/dev/null 2\u003e\u00261 ; pwd -P )\"\r\n\r\n    # Change to library directory\r\n    # TODO: Adapt the path according to your repository structure\r\n    cd \"${CWD}/../lib/SHlib\" \u003e/dev/null 2\u003e\u00261 || return\r\n\r\n    # Source libraries\r\n    for lib in ./*.lib.sh; do\r\n      . \"${lib}\"                                                        || \\\r\n      {\r\n        printf \"%s\\n\\n\"                                                 \\\r\n          \"ERROR: Library '$lib' could not be loaded. Aborting...\" \u003e\u00262\r\n        cd \"${CWD}\"\r\n        return 1\r\n      }\r\n    done\r\n\r\n    # Restore original directory\r\n    cd \"${CWD}\"\r\n    ```\r\n\r\n\u003cp align=\"right\"\u003e(\u003ca href=\"#readme-top\"\u003eback to top\u003c/a\u003e)\u003c/p\u003e\r\n\r\n\r\n\r\n\u003c!-- DOCUMENTATION --\u003e\r\n## Documentation\r\n\r\n\u003e :warning: The following sections only give a brief overview. Before running any of these functions please have a look at the comments in the source files.\r\n\r\nThe library is separated in several files where each file stores a certain category of functions and/or constants:\r\n\r\n| File (/lib/...) | Description\r\n---: | ---\r\n[`c.lib.sh`](#clibsh) | Constants used by other library files and shell projects\r\n[`core.lib.sh`](#corelibsh) | Essential functions, e.g. type/regex checks, variable manipulation, etc.\r\n[`iperf3.lib.sh`](#iperf3libsh) | `iperf3`-related functions\r\n[`math.lib.sh`](#mathlibsh) | Mathematical functions and operations\r\n[`msg.lib.sh`](#msglibsh) | Logging and output formatting functions\r\n[`net.lib.sh`](#netlibsh) | Network-related functions\r\n[`nm.lib.sh`](#nmlibsh) | `nmcli`-related functions (NetworkManager)\r\n[`openwrt.lib.sh`](#openwrtlibsh) | `OpenWRT`-related functions\r\n[`os.lib.sh`](#oslibsh) | OS-related functions\r\n[`tcpdump.lib.sh`](#tcpdumplibsh) | `tcpdump`-related functions\r\n\r\n\u003cp align=\"right\"\u003e(\u003ca href=\"#readme-top\"\u003eback to top\u003c/a\u003e)\u003c/p\u003e\r\n\r\n\r\n\r\n### `c.lib.sh`\r\nThis file contains constans that are used by other library files and/or other projects, e.g.\r\n  * Linux distribution IDs,\r\n  * language IDs (ISO 639-1),\r\n  * further text constants.\r\n\r\n\u003cp align=\"right\"\u003e(\u003ca href=\"#documentation\"\u003eback to overview\u003c/a\u003e)\u003c/p\u003e\r\n\r\n\r\n\r\n### `core.lib.sh`\r\nFunction | Description\r\n:--- | :---\r\n`lib_core_args_passed` | Check if at least one argument has been passed\r\n`lib_core_bool2int` | Convert one or more boolean values to integer values\r\n`lib_core_can_sudo_nopasswd` | Check if current user can sudo without password prompt\r\n`lib_core_char_repeat` | Repeat a given character for a certain number of times\r\n`lib_core_cmd_exists` | Check if (one or more) commands exist on the host\r\n`lib_core_cmd_exists_su` | Check if (one or more) commands exist when using root\r\n`lib_core_echo` | Print a message\r\n`lib_core_env_append` | Append one or more values to an environment variable\r\n`lib_core_env_remove` | Remove one or more values from an environment variable\r\n`lib_core_expand_tilde` | Expand '~' to the user's home directory '$HOME' in a given path\r\n`lib_core_file_get` | Get file information\r\n`lib_core_file_touch` | Create one or more files and (if needed) their parent folders\r\n`lib_core_float2int` | Convert one or more floating point numbers to integer\r\n`lib_core_int_is_within_range` | Check if an integer number is between a given range. This function is only intended for integer numbers. To process floating point numbers please use `lib_math_is_within_range`.\r\n`lib_core_int_max` | Return maximum of a list of integer values\r\n`lib_core_int_min` | Return minimum of a list of integer values\r\n`lib_core_is` | Perform checks on current environment (root, interactive shell, etc.) and arguments (bool, file, integer, etc.)\r\n`lib_core_list` | Add/Remove one or multiple string(s) from a list of strings or check if one or multiple string(s) are part of this list\r\n`lib_core_list_contains_str` | Look for a string within a delimited list of strings\r\n`lib_core_list_contains_str_ptr` | Look for a string within a delimited list of strings where the list does not(!) contain the strings themselves but their variable pointers\r\n`lib_core_parse_credentials` | Parse credentials that are provided via an environment variable\r\n`lib_core_path_get_abs` | Get absolute path to a directory or file (in case it contains relative paths or symlinks)\r\n`lib_core_str_escape_chars_sed` | Escape ('\\...') characters that are special to 'sed' command\r\n`lib_core_str_get_length` | Get length of a string\r\n`lib_core_str_filter_and_sort` | Filter and sort a (multiline) string\r\n`lib_core_str_get_substr` | Extract a substring from a given string\r\n`lib_core_str_is_multiline` | Check if one or more strings contain more than one line\r\n`lib_core_str_random` | Generate a random string\r\n`lib_core_str_remove_leading` | Remove leading character(s) from one or multiple string(s)\r\n`lib_core_str_remove_newline` | Replace line breaks from a string by a certain character\r\n`lib_core_str_remove_trailing` | Remove trailing character(s) from one or multiple string(s)\r\n`lib_core_str_replace_char` | Replace (or delete) all occurrences of a character in a string by using `tr` command.\r\n`lib_core_str_replace_substr` | Replace (or delete) all occurrences of a substring in a string by using `sed` command.\r\n`lib_core_str_split` | Split a given string into substrings (separated by `\u003cnewline\u003e`) but preserve quoted (`\"...\"`) substrings even if they contain spaces\r\n`lib_core_str_to` | Convert one or multiple string(s)\r\n`lib_core_sudo` | Execute one or more commands with root privileges\r\n`lib_core_sudo_background` | Execute one or more commands with root privileges and put them into background\r\n`lib_core_sysfs_get` | Wrapper for accessing `sysfs`\r\n`lib_core_time_timestamp` | Get current time in UNIX Epoch format\r\n`lib_core_var_is` | Perform general checks (defined, null, etc.) and type checks (bool, file, integer, etc.) on variables. Similar to `lib_core_is` but expects identifiers (`var1 var2 ...`) instead of values (`$var1 $var2 ...`).\r\n\r\n\u003cp align=\"right\"\u003e(\u003ca href=\"#documentation\"\u003eback to overview\u003c/a\u003e)\u003c/p\u003e\r\n\r\n\r\n\r\n\r\n### `iperf3.lib.sh`\r\n| Function | Description\r\n:--- | :---\r\n`lib_iperf3_log_parse_transfer_rate` | Extract transfer rate from an ipferf3 log\r\n\r\n\u003cp align=\"right\"\u003e(\u003ca href=\"#documentation\"\u003eback to overview\u003c/a\u003e)\u003c/p\u003e\r\n\r\n### `math.lib.sh`\r\n| Function | Description\r\n:--- | :---\r\n`lib_math_abs` | Calculate absolute value of one or more given values (`abs(x)`)\r\n`lib_math_calc` | Perform a calculation supporting decimal places by using `bc`\r\n`lib_math_convert_unit` | Convert a given value (integer/float) from one unit to another\r\n`lib_math_is_within_range` | Check if an (integer or float) number is between a given range\r\n`lib_math_is_within_range_u` | Like `lib_math_is_within_range` but with units\r\n`lib_math_sign` | Get sign of one or more given values (`sign(x)`)\r\n\r\n\u003cp align=\"right\"\u003e(\u003ca href=\"#documentation\"\u003eback to overview\u003c/a\u003e)\u003c/p\u003e\r\n\r\n\r\n\r\n### `msg.lib.sh`\r\n| Function | Description\r\n:--- | :---\r\n`lib_msg_dialog_autosize` | Calculate the size of dialog boxes (see `man dialog`)\r\n`lib_msg_echo` | Print error/info/warning message to `stdout`/`stderr`\r\n`lib_msg_log` | Log error/info/warning message to `syslog`\r\n`lib_msg_message` | Log/Print error/info/warning message and optionally exit\r\n`lib_msg_print_borderstring` | Print a string surrounded by border characters\r\n`lib_msg_print_heading` | Format a string as a heading\r\n`lib_msg_print_list` | Format and print values from a list\r\n`lib_msg_print_propvalue` | Print a formatted table of property/value pairs to `stdout`\r\n`lib_msg_term_get` | Get current terminal window's settings\r\n\r\n\u003cp align=\"right\"\u003e(\u003ca href=\"#documentation\"\u003eback to overview\u003c/a\u003e)\u003c/p\u003e\r\n\r\n\r\n\r\n### `net.lib.sh`\r\n| Function | Description\r\n:--- | :---\r\n`lib_net_bridge_create` | Create a network bridge and attach one or more physical interfaces to it\r\n`lib_net_bridge_get_members` | Get network bridge members\r\n`lib_net_bridge_remove` | Remove a network bridge\r\n`lib_net_dns_resolve` | Resolve a given hostname, FQDN, SRV record, into IP address(es) (automatically detect the type of the input string)\r\n`lib_net_host_is_up` | Check if a host is reachable on a given port\r\n`lib_net_iface_get_sysfs / lib_net_iface_get_sysfs_statistics` | Get information about network interface using Linux kernel's \u003csysfs-class-net\u003e / \u003csysfs-class-net-statistics\u003e\r\n`lib_net_iface_get_ip` | Get the current IP address of a network interface\r\n`lib_net_iface_get_master` | Get master bridge that a (slave) device is attached to\r\n`lib_net_iface_ip` | Add/Remove an IP address to/from a network device\r\n`lib_net_iface_is` | Checks if one or interfaces are in a certain state (up|down|...)\r\n`lib_net_ifconfig_parse_stats` | Parse \u003cifconfig\u003e output\r\n\r\n\u003cp align=\"right\"\u003e(\u003ca href=\"#documentation\"\u003eback to overview\u003c/a\u003e)\u003c/p\u003e\r\n\r\n\r\n\r\n### `nm.lib.sh`\r\n| Function | Description\r\n:--- | :---\r\n`lib_nm_con_exists` | Check if a a connection exists and optionally check if it's active\r\n`lib_nm_con_get` | Get a certain connection setting/property\r\n`lib_nm_con_list` | List connections (optionally filtered)\r\n`lib_nm_con_modify` | Modify a certain connection setting/property\r\n\r\n\u003cp align=\"right\"\u003e(\u003ca href=\"#documentation\"\u003eback to overview\u003c/a\u003e)\u003c/p\u003e\r\n\r\n\r\n\r\n### `openwrt.lib.sh`\r\n| Function | Description\r\n:--- | :---\r\n`lib_openwrt_procd_install` | Install and optionally enable/start procd init service\r\n\r\n\u003cp align=\"right\"\u003e(\u003ca href=\"#documentation\"\u003eback to overview\u003c/a\u003e)\u003c/p\u003e\r\n\r\n\r\n\r\n\r\n### `os.lib.sh`\r\n| Function | Description\r\n:--- | :---\r\n`lib_os_cgroup_parse_cpuacct` | Parse `cgroup` CPU accounting controller statistics\r\n`lib_os_cgroup_parse_mem` | Parse `cgroup` memory statistics\r\n`lib_os_boot_configure` | Modify bootloader settings\r\n`lib_os_boot_configure_grub` | Modify \"GRUB_CMDLINE_LINUX_DEFAULT\" in GRUB settings\r\n`lib_os_cpu_get` | Get CPU statistics\r\n`lib_os_cpu_has_feature` | Check if (all) installed CPU(s) support(s) a given feature\r\n`lib_os_dev_bus_usb_list` | List all currently connected USB devices with their corresponding device path (`/dev/...`), their manufacturer and their product name\r\n`lib_os_dev_bus_usb_list_by_busdev` | List device paths (`/dev/...`) of USB devices matching (one or more) given bus and device numbers\r\n`lib_os_dev_bus_usb_list_by_vidpid` | List device paths (`/dev/...`) of USB devices matching (one or more) given vendor and/or product IDs\r\n`lib_os_dev_class_list` | List device paths (`/dev/...`) and corresponding IDs/names of a certain class\r\n`lib_os_dev_is_mounted` | Check if (one or more) block devices are mounted\r\n`lib_os_dev_umount` | Unmount (one or more) block devices including slave devices\r\n`lib_os_dev_lsblk` | Get information about (one or more) block device using `lsblk`\r\n`lib_os_get` | Get statistics about current distribution (ID, version, etc.)\r\n`lib_os_is_subshell` | Check if the function that calls this function is running in a subshell\r\n`lib_os_lib` | Check existence or get absolute path of a given library (.so) file\r\n`lib_os_proc_meminfo` | Get memory statistics\r\n`lib_os_ps_exists` | Check if a process with a given PID exists\r\n`lib_os_ps_get_descendants` | Look for sub-processes\r\n`lib_os_ps_get_mem` | Retrieve a process's memory (RAM) usage\r\n`lib_os_ps_get_ownpid` | Get current shell's process ID\r\n`lib_os_ps_get_pid` | Retrieve process ID(s) from a process defined via its name\r\n`lib_os_ps_kill_by_name` | Kill a process by its name\r\n`lib_os_ps_kill_by_pid` | Kill one or several processes by their PIDs\r\n`lib_os_ps_kill_by_pidfile` | Kill a process by a PID file\r\n`lib_os_ps_pidlock`| Enable a script to lock itself (prevent further instances) by using a PID file\r\n`lib_os_scp_no_host_key_check` | SCP wrapper (SSH's host key binding check disabled)\r\n`lib_os_ssh_no_host_key_check` | SSH command wrapper (SSH's host key binding check disabled)\r\n`lib_os_ssh_test` | Check if one or more hosts are accessible via SSH (batch mode)\r\n`lib_os_ssh_wrapper` | SSH command wrapper\r\n`lib_os_user_is_member_of` | Check if current (or another) user is a member of a certain group\r\n\r\n\u003cp align=\"right\"\u003e(\u003ca href=\"#documentation\"\u003eback to overview\u003c/a\u003e)\u003c/p\u003e\r\n\r\n\r\n\r\n\r\n### `regex.lib.sh`\r\n| Function | Description\r\n:--- | :---\r\n`lib_regex` | Check if a given string matches a regular expression\r\n\r\n\u003cp align=\"right\"\u003e(\u003ca href=\"#documentation\"\u003eback to overview\u003c/a\u003e)\u003c/p\u003e\r\n\r\n\r\n\r\n\r\n### `tcpdump.lib.sh`\r\n| Function | Description\r\n:--- | :---\r\n`lib_tcpdump_parse_logfile` | Parse tcpdump logfile\r\n\r\n\u003cp align=\"right\"\u003e(\u003ca href=\"#documentation\"\u003eback to overview\u003c/a\u003e)\u003c/p\u003e\r\n\r\n\r\n\r\n\u003c!-- ROADMAP --\u003e\r\n## Roadmap\r\n\r\nSee the [open issues](https://github.com/fkemser/SHlib/issues) for a full list of proposed features (and known issues).\r\n\r\n\u003cp align=\"right\"\u003e(\u003ca href=\"#readme-top\"\u003eback to top\u003c/a\u003e)\u003c/p\u003e\r\n\r\n\r\n\r\n\u003c!-- CONTRIBUTING --\u003e\r\n## Contributing\r\n\r\nContributions are what make the open source community such an amazing place to learn, inspire, and create. Any contributions you make are **greatly appreciated**.\r\n\r\nIf you have a suggestion that would make this better, please fork the repo and create a pull request. You can also simply open an issue with the tag \"enhancement\".\r\nDon't forget to give the project a star! Thanks again!\r\n\r\n1. Fork the Project\r\n2. Create your Feature Branch (`git checkout -b feature/AmazingFeature`)\r\n3. Commit your Changes (`git commit -m 'Add some AmazingFeature'`)\r\n4. Push to the Branch (`git push origin feature/AmazingFeature`)\r\n5. Open a Pull Request\r\n\r\n\u003cp align=\"right\"\u003e(\u003ca href=\"#readme-top\"\u003eback to top\u003c/a\u003e)\u003c/p\u003e\r\n\r\n\r\n\r\n\u003c!-- LICENSE --\u003e\r\n## License\r\n\r\nDistributed under the **GNU Lesser General Public License v3.0 (or later)**. See [`LICENSE`][license-url] for more information.\r\n\r\n\u003cp align=\"right\"\u003e(\u003ca href=\"#readme-top\"\u003eback to top\u003c/a\u003e)\u003c/p\u003e\r\n\r\n\r\n\r\n\u003c!-- CONTACT --\u003e\r\n## Contact\r\n\r\nProject Link: [https://github.com/fkemser/SHlib](https://github.com/fkemser/SHlib)\r\n\r\n\u003cp align=\"right\"\u003e(\u003ca href=\"#readme-top\"\u003eback to top\u003c/a\u003e)\u003c/p\u003e\r\n\r\n\r\n\r\n\u003c!-- ACKNOWLEDGMENTS --\u003e\r\n## Acknowledgments\r\n###\r\n* [othneildrew/Best-README-Template](https://github.com/othneildrew/Best-README-Template)\r\n* [Ileriayo/markdown-badges](https://github.com/Ileriayo/markdown-badges)\r\n\r\n\u003cp align=\"right\"\u003e(\u003ca href=\"#readme-top\"\u003eback to top\u003c/a\u003e)\u003c/p\u003e\r\n\r\n\r\n\r\n\u003c!-- MARKDOWN LINKS \u0026 IMAGES --\u003e\r\n\u003c!-- https://www.markdownguide.org/basic-syntax/#reference-style-links --\u003e\r\n[contributors-shield]: https://img.shields.io/github/contributors/fkemser/SHlib.svg?style=for-the-badge\r\n[contributors-url]: https://github.com/fkemser/SHlib/graphs/contributors\r\n[forks-shield]: https://img.shields.io/github/forks/fkemser/SHlib.svg?style=for-the-badge\r\n[forks-url]: https://github.com/fkemser/SHlib/network/members\r\n[stars-shield]: https://img.shields.io/github/stars/fkemser/SHlib.svg?style=for-the-badge\r\n[stars-url]: https://github.com/fkemser/SHlib/stargazers\r\n[issues-shield]: https://img.shields.io/github/issues/fkemser/SHlib.svg?style=for-the-badge\r\n[issues-url]: https://github.com/fkemser/SHlib/issues\r\n[license-shield]: https://img.shields.io/github/license/fkemser/SHlib.svg?style=for-the-badge\r\n[license-url]: https://github.com/fkemser/SHlib/blob/main/LICENSE\r\n[linkedin-shield]: https://img.shields.io/badge/-LinkedIn-black.svg?style=for-the-badge\u0026logo=linkedin\u0026colorB=555\r\n[linkedin-url]: https://linkedin.com/in/linkedin_username\r\n\r\n[LaTeX-shield]: https://img.shields.io/badge/latex-%23008080.svg?style=for-the-badge\u0026logo=latex\u0026logoColor=white\r\n[LaTeX-url]: https://www.latex-project.org/\r\n[Shell Script-shield]: https://img.shields.io/badge/shell_script-%23121011.svg?style=for-the-badge\u0026logo=gnu-bash\u0026logoColor=white\r\n[Shell Script-url]: https://pubs.opengroup.org/onlinepubs/9699919799/","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffkemser%2Fshlib","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffkemser%2Fshlib","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffkemser%2Fshlib/lists"}