Skip to content

szabomeister/bash-fx

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

65 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

bash-fx

A collection of common Bash functions and variables

Usage

At the top of the script:

## bash-fx
if [ -f "/usr/local/turbolab.it/bash-fx/bash-fx.sh" ]; then
  source "/usr/local/turbolab.it/bash-fx/bash-fx.sh"
else
  source <(curl -s https://raw.githubusercontent.com/TurboLabIt/bash-fx/main/bash-fx.sh)
fi
## bash-fx is ready

fxHeader "MY SCRIPT NAME"
rootCheck

How to create a setup.sh

In the project setup.sh:

#!/usr/bin/env bash
echo ""
SCRIPT_NAME=sample-script-name

## bash-fx
if [ -z "$(command -v curl)" ]; then
  sudo apt update && sudo apt install curl -y
fi
curl -s https://raw.githubusercontent.com/TurboLabIt/bash-fx/master/setup.sh?$(date +%s) | sudo bash
source /usr/local/turbolab.it/bash-fx/bash-fx.sh
## bash-fx is ready

sudo bash /usr/local/turbolab.it/bash-fx/setup/begin.sh ${SCRIPT_NAME}

## Symlink (globally-available zzfirewall command)
if [ ! -f "/usr/local/bin/${SCRIPT_NAME}" ]; then
  ln -s ${INSTALL_DIR}${SCRIPT_NAME}.sh /usr/local/bin/${SCRIPT_NAME}
fi

## ... other stuff ...

sudo bash /usr/local/turbolab.it/bash-fx/setup/end.sh ${SCRIPT_NAME}

Live example

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Shell 100.0%