Bash Shell Function Library. More...
Functions | |
| __array_append (array, item) | |
| Internal use. More... | |
| __array_append_first (array, item) | |
| Internal use. More... | |
| __array_len (variable, array) | |
| Internal use. More... | |
| __raw_status (status, color) | |
| Internal use. More... | |
| __stack_push_tmp (item) | |
| Internal use. More... | |
| array_append (array) | |
| Appends one or more items to an array. More... | |
| array_print (array) | |
| Prints the content of an array. More... | |
| array_size (array) | |
| Returns the size of an array. More... | |
| cidr2mask (netmask) | |
| Converts CIDR notation into IPv4 decimal netmask. More... | |
| cmd (command) | |
| Executes a command and displays its status ('OK' or 'FAILED'). More... | |
| defined (variable) | |
| Tests if a variable is defined. More... | |
| device_exists (device) | |
| Tests if a device exists. More... | |
| die (errcode, errmsg) | |
| Prints an error message to stderr and exits with the error code given as parameter. The message is also logged. More... | |
| die_if_false (errcode, errmsg) | |
| Displays an error message and exits if the previous command has failed (if its error code is not '0'). More... | |
| die_if_true (errcode, errmsg) | |
| Displays an error message and exits if the previous command has succeeded (if its error code is '0'). More... | |
| directory_exists (directory) | |
| Tests if a directory exists. More... | |
| display_status (status) | |
| Displays the specified message status on the right side of the screen. More... | |
| elapsed (start, stop) | |
| Displays the time elapsed between the 'start' and 'stop' parameters. More... | |
| file_exists (file) | |
| Tests if a file exists. More... | |
| get_ipv4_broadcast (address, netmask) | |
| Computes the broadcast address of an IPv4 subnet. More... | |
| get_ipv4_network (address, netmask) | |
| Computes the network address of an IPv4 subnet. More... | |
| has_value (variable) | |
| Tests if a variable has a value. More... | |
| is_fqdn (fqdn) | |
| Tests a FQDN. More... | |
| is_ipv4 (address) | |
| Tests an IPv4 address. More... | |
| is_ipv4_cidr (netmask) | |
| Tests an IPv4 CIDR netmask. More... | |
| is_ipv4_netmask (netmask) | |
| Tests if an IPv4 decimal netmask is valid. More... | |
| is_ipv4_subnet (subnet) | |
| Tests an IPv4 subnet. More... | |
| log (message, status) | |
| Writes a message in a log file and/or to syslog. More... | |
| log2syslog (message) | |
| Logs a message using syslog. More... | |
| log_alert (message) | |
| Logs a message with the 'alert' status. More... | |
| log_critical (message) | |
| Logs a message with the 'critical' status. More... | |
| log_debug (message) | |
| Logs a message with the 'debug' status. More... | |
| log_emergency (message) | |
| Logs a message with the 'emergency' status. More... | |
| log_error (message) | |
| Logs a message with the 'error' status. More... | |
| log_failed (message) | |
| Logs a message with the 'failed' status. More... | |
| log_info (message) | |
| Logs a message with the 'info' status. More... | |
| log_not_ok (message) | |
| Logs a message with the 'not ok' status. More... | |
| log_notice (message) | |
| Logs a message with the 'notice' status. More... | |
| log_ok (message) | |
| Logs a message with the 'ok' status. More... | |
| log_passed (message) | |
| Logs a message with the 'passed' status. More... | |
| log_status (message, status) | |
| Logs a message with its status. More... | |
| log_success (message) | |
| Logs a message with the 'success' status. More... | |
| log_warning (message) | |
| Logs a message with the 'warning' status. More... | |
| mask2cidr (netmask) | |
| Converts IPv4 decimal netmask notation into CIDR. More... | |
| msg (message, color) | |
| Similar to the 'echo' function but with extra features. More... | |
| msg_alert (message) | |
| Displays a message with the 'alert' status. More... | |
| msg_critical (message) | |
| Displays a message with the 'critical' status. More... | |
| msg_debug (message) | |
| Displays a message with the 'debug' status. More... | |
| msg_emergency (message) | |
| Displays a message with the 'emergency' status. More... | |
| msg_error (message) | |
| Displays a message with the 'error' status. More... | |
| msg_failed (message) | |
| Displays a message with the 'failed' status. More... | |
| msg_info (message) | |
| Displays a message with the 'info' status. More... | |
| msg_not_ok (message) | |
| Displays a message with the 'not ok' status. More... | |
| msg_notice (message) | |
| Displays a message with the 'notice' status. More... | |
| msg_ok (message) | |
| Displays a message with the 'ok' status. More... | |
| msg_passed (message) | |
| Displays a message with the 'passed' status. More... | |
| msg_status (message, status) | |
| Displays a message with its status at the end of the line. More... | |
| msg_success (message) | |
| Displays a message with the 'success' status. More... | |
| msg_warning (message) | |
| Displays a message with the 'warning' status. More... | |
| now () | |
| Displays the current timestamp. More... | |
| option_enabled (variable) | |
| Checks if a variable is set to "y" or "yes". More... | |
| stack_pop () | |
| Removes the highest item of the stack and puts it in the 'REGISTER' variable. More... | |
| stack_push (item) | |
| Adds an item on the stack. More... | |
| start_watch () | |
| Starts the watch. | |
| stop_watch () | |
| Stops the watch and displays the time elapsed. More... | |
| str_replace (origin, destination, data) | |
| Replaces some text in a string. More... | |
| str_replace_in_file (origin, destination, file) | |
| Replaces some text in a file. More... | |
| to_lower (string) | |
| Converts uppercase characters in a string to lowercase. More... | |
| to_upper (string) | |
| Converts lowercase characters in a string to uppercase. More... | |
| trim (string) | |
| Removes whitespace from both ends of a string. More... | |
Variables | |
| String | __STACK |
| Internal use. | |
| String | __START_WATCH = "" |
| Internal use. | |
| String | __TMP_STACK |
| Internal use. | |
| ReadOnly String | BLUE = "tput setaf 4" |
| Internal color. | |
| ReadOnly String | BLUE_BG = "tput setab 4" |
| Internal color. | |
| ReadOnly String | BOLD = "tput bold" |
| Internal color. | |
| ReadOnly String | BSFL_VERSION = "0.1.0" |
| BSFL version number. | |
| ReadOnly String | CYAN = "tput setaf 6" |
| Internal color. | |
| ReadOnly String | CYAN_BG = "tput setab 6" |
| Internal color. | |
| String | DEBUG = "no" |
| Enables / disables the debug mode. More... | |
| ReadOnly String | DEFAULT = "tput sgr0" |
| Internal color. | |
| Exported String | DONOTLOG = "yes" |
| ReadOnly String | GREEN = "tput setaf 2" |
| Internal color. | |
| ReadOnly String | GREEN_BG = "tput setab 2" |
| Internal color. | |
| String | LOG_ENABLED = "no" |
| Enables / disables logging in a file. More... | |
| String | LOG_FILE = "$0.log" |
| Sets the log file to use when the logs are enabled. | |
| String | LOGDATEFORMAT = "%FT%T%z" |
| Sets the log data format (syslog style). | |
| ReadOnly String | MAGENTA = "tput setaf 5" |
| Internal color. | |
| ReadOnly String | MAGENTA_BG = "tput setab 5" |
| Internal color. | |
| ReadOnly String | RED = "tput setaf 1" |
| Internal color. | |
| ReadOnly String | RED_BG = "tput setab 1" |
| Internal color. | |
| String | SYSLOG_ENABLED = "no" |
| Enables / disables logging to syslog. More... | |
| String | SYSLOG_TAG = "$0" |
| Tag to use with syslog. More... | |
| ReadOnly String | YELLOW = "tput setaf 3" |
| Internal color. | |
| ReadOnly String | YELLOW_BG = "tput setab 3" |
| Internal color. | |
Bash Shell Function Library.
| DEBUG = "no" |
Enables / disables the debug mode.
The debug mode adds extra information for troubleshooting purposes. Value: yes or no (y / n).
| LOG_ENABLED = "no" |
Enables / disables logging in a file.
Value: yes or no (y / n).
| SYSLOG_ENABLED = "no" |
Enables / disables logging to syslog.
Value: yes or no (y / n).
| SYSLOG_TAG = "$0" |
Tag to use with syslog.
Value: yes or no (y / n).
1.8.6