Last active
September 10, 2020 20:21
-
-
Save jessuppi/3356c3031281872eb85120020fca4daa to your computer and use it in GitHub Desktop.
SlickStack Bash Functions (Aliases) + Environment Variables
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
#################################################################################################### | |
#### SlickStack: Critical Bash Functions (Aliases) + Script Variables ############################## | |
#################################################################################################### | |
## the below functions are hardcoded into every SlickStack script to ensure reliability ## | |
## this also speeds up processing times by avoiding repeated inline commands ## | |
## add-apt-repository alias flags ## | |
function add-apt-repository { | |
export DEBIAN_FRONTEND=noninteractive | |
export DEBIAN_PRIORITY=critical | |
export PATH='/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin' | |
command /usr/bin/add-apt-repository --yes "$@" | |
} | |
## apt alias flags ## | |
function apt { | |
export DEBIAN_FRONTEND=noninteractive | |
export DEBIAN_PRIORITY=critical | |
export PATH='/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin' | |
command /usr/bin/apt --yes --quiet --option Dpkg::Options::=--force-confold --option Dpkg::Options::=--force-confdef "$@" | |
} | |
## cp alias flags ## | |
function cp { | |
command cp -R -f -d --no-preserve=mode,ownership "$@" | |
} | |
## ln alias flags ## | |
function ln { | |
command ln -s -f "$@" | |
} | |
## mkdir alias flags ## | |
function mkdir { | |
command mkdir -p "$@" | |
} | |
## mysql alias flags ## | |
function mysql { | |
command mysql --user=root --host=localhost --protocol=socket --port=3306 --force "$@" | |
} | |
## mysqldump alias flags ## | |
function mysqldump { | |
# /usr/bin/mysqldump | |
command mysqldump --user=$DB_USER --password=$DB_PASSWORD --host=$DB_HOST --protocol=tcp --port=3306 --no-tablespaces --single-transaction --skip-lock-tables --dump-date --force "$@" | |
} | |
## rm alias flags ## | |
function rm { | |
command rm -R -f "$@" | |
} | |
## rsync alias flags ## | |
function rsync { | |
command rsync -aI --ignore-errors "$@" | |
} | |
## unzip alias flags ## | |
function unzip { | |
command unzip -o "$@" | |
} | |
## wget alias flags ## | |
function wget { | |
command wget --no-check-certificate --no-cache --no-cookies --tries=3 --timeout=15 "$@" | |
} | |
#################################################################################################### | |
#### SlickStack: Critical Variables For This Script To Work ######################################## | |
#################################################################################################### | |
## something like environment variables but not exactly that are placed in core scripts ## | |
## we keep these variables together for easy reference and better organization ## | |
UBUNTU_VERSION=`lsb_release -rs` | |
DISK_FREE=`df -k --output=avail "$PWD" | tail -n1` |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Reserving first comment