Useful lines of bash code that are not full functions
#Snip will cat a file and truncate any new line character at the end
$(cat SOME_FILE | tr -d '\n')
#This is a var that will only render if another var is not null
# if REQUIRE_VAR is not null then the DEPENDENT_VAR part of the string will render
# the value you set in REQUIRED_VAR will not render
${REQUIRE_VAR:+ "$DEPENDENT_VAR"}
#Remove -tests from the output if it exists
if grep -q -e '-tests' <<< ${VERSION}; then
local len1=${#VERSION}
local len2=`expr $len1 - 6`
VERSION=`echo $VERSION | cut -c 1-$len2`
fi
if grep -q -e 'tests-' <<< ${VERSION}; then
VERSION=${VERSION#tests-}
fi