This repository provides helper functions for bash
applications.
NOTE: It is recommended that you do not source this file directly into an interactive terminal as any typo or missing variable will cause the shell to exit.
We use the following set
configuration (descriptions from man bash
):
-e
: Exit immediately if a pipeline exits with a non-zero status-u
: Treat unset variables and parameters other than the special parameters "@" and "*" as an error when performing parameter expansion
-
logInfo
- Simple log function that prints to standard out with command sequences supported
-
logError
- Simple log function that prints to standard error with command sequences supported
checkProcessIsAlive
- Checks the specified PID to determine it is running on the current host
-
loadConfigFile
- Loads a CSV file, ignoring any lines that begin with a hash (
#
) or a space
- Loads a CSV file, ignoring any lines that begin with a hash (
-
getConfigFileColumn
- Returns an array of the specified column from a CSV file
-
getConfigFileRowsStrMatch
- Returns the rows of a CSV file that match a specified regex
-
ensurePathEndsInSlash
- Takes a string path and appends a slash (
/
) if the path does not already end in one. Otherwise returns the string unmodified
- Takes a string path and appends a slash (
-
arrayContains
- Checks if a specified string exists within an array
-
getPreviousPartialDate
- Returns a historical date based on a period and unit of time from today