Home

Awesome

Donate

Overview

A Bash Shell library file for commonly used functions can be imported into shell scripts to create functional and colorful scripts and Terminal users interfaces(TUI). The library allows user to redefine commonly used functions every time you write a shell script, the library may save a part of the development time.

Table of contents

Installation

Linux debian based systems built on Ubuntu 22.04 LTS (Jammy Jellyfish)

A Personal Package Archives (PPA) has been created on Ubuntu package building and hosting section of launchpad site called bashmultitool.

To install this on your system run commands in terminal

sudo add-apt-repository ppa:typematrix/bashmultitool
sudo apt update
sudo apt install bashmultitool

Arch based System

Package available in the Arch Linux user repo AUR

For other linux systems

Download latest fixed release and run the makefile as per terminal commands below for version 2.1 latest release at time of writing Note: If you install with this method you will not be informed of updates by system.

curl -sL https://github.com/gavinlyonsrepo/bashmultitool/archive/2.1.tar.gz | tar xz
cd  bashmultitool-2.1
sudo make install

Usage

Source the library functions from your bash shell scripts like so:

LIBPATH="/usr/lib/bashmultitool/"
for MYFILE in "$LIBPATH"*;
do
	source "$MYFILE"
done

To access library functions from your shell scripts type:

# [function-name] [keyword] [options]
# eg

bmtPrintFunc b_red "Hello World"

Software

Eight separate markdown help files with detailed information, in documentation folder are available. For shortcut to each help file click on link in 2nd table below. A script to print library meta data is also installed.

Installed File PathDescription
/usr/bin/bashmultitoolScript to print library meta data
/usr/lib/bashmultitool/bashmultitool/*8 library files see next table
/usr/lib/bashmultitool/doc/README.mdreadme
/usr/lib/bashmultitool/doc/bmt*.md8 Documentation files see next table
Library fileFunctionSectionsContentDoc link
bmtPrintbmtPrintFunc101Printing textbmtPrint help file
bmtPromptbmtPromptFunc201-210Prompts bmtPrompt help file
bmtNetworkbmtNetworkFunc301-302Network relatedbmtNetwork help file
bmtLinuxbmtLinuxFunc401-408Linux relatedbmtLinux help file
bmtFilesbmtFilesFunc501-510File relatedbmtFiles help file
bmtDatabtmDataFunc601-607Data relatedbmtData help file
bmtTimebtmTimeFunc701-710Time relatedbmtTime help file
bmtMiscbmtMiscFunc801-806MiscellaneousbmtMisc help file
bmtTestbmtTestFunc901internal library testbmtTest help file

The library contains eight section's, Each section has one file with one function. Which contains 54 sub-sections in total. The sections are grouped per logical function. Printing, prompting, Linux related, file related, data related, time related , network related and miscellaneous. The sections are mostly independent of each other you can source them individually if you wish, however the prompt file is dependent on print. There is also a ninth test section bmtTest used to test library.

The repo also contains a test folder where a test file used in development are available, one function for each library file. The test file "testTest.sh", runs an semi-automated test on entire library and produces a report. Pass the test file a number between 1-9 , 1-8 correspond to the sections, 9 will test entire library.

Example

Output of basic example file in example folder, showing basic usage.

ScreenShot

Output report of test script testTest.sh.

ScreenShot