Skip to content

Instantly share code, notes, and snippets.

@xxxludixxx
xxxludixxx / state-machine.sh
Created October 4, 2016 12:25
Bash stack - Bash state machine
function stateMachine.push() { # Pushes the given value into the stack.
: ${1? 'Missing attribute name'} # Error status for missing attribute name.
: ${2? 'Missing values(s) to push'} # Error status for missing value.
local attribute="${1^^}"; # Function's local variables
local value="${2^^}"; #
local arrayName="STATE_MACHINE_${attribute}" #
if [[ $( stateMachine.exist "$arrayName" ) == 0 ]]; then
eval "${arrayName}+=(${value})";
@xxxludixxx
xxxludixxx / .gitignore
Created August 25, 2016 10:56 — forked from octocat/.gitignore
Some common .gitignore configurations
# Compiled source #
###################
*.com
*.class
*.dll
*.exe
*.o
*.so
# Packages #