fixed function

This commit is contained in:
Nathaniel Landau
2016-12-31 09:36:34 -05:00
parent 395f1bf86e
commit 350080fcff

View File

@@ -332,7 +332,6 @@ function unmountDrive() {
# text is available in the script they will be printed # text is available in the script they will be printed
# in the '$usage' variable. # in the '$usage' variable.
# ------------------------------------------------------ # ------------------------------------------------------
function help () { function help () {
echo "" 1>&2 echo "" 1>&2
input " $@" 1>&2 input " $@" 1>&2
@@ -351,7 +350,6 @@ function help () {
# manager 'Homebrew'. # manager 'Homebrew'.
# Usage in script: $ homebrewDependencies=(package1 package2) # Usage in script: $ homebrewDependencies=(package1 package2)
# ----------------------------------- # -----------------------------------
function checkDependencies() { function checkDependencies() {
saveIFS=$IFS saveIFS=$IFS
IFS=$' \n\t' IFS=$' \n\t'
@@ -383,13 +381,10 @@ function checkDependencies() {
IFS=$saveIFS IFS=$saveIFS
} }
# pauseScript
# -----------------------------------
# A simple function used to pause a script at any point and
# only continue on user input
# -----------------------------------
function pauseScript() { function pauseScript() {
# A simple function used to pause a script at any point and
# only continue on user input
seek_confirmation "Ready to continue?" seek_confirmation "Ready to continue?"
if is_confirmed; then if is_confirmed; then
info "Continuing" info "Continuing"
@@ -401,7 +396,7 @@ function pauseScript() {
function in_array() { function in_array() {
# Determine if a value is in an array. # Determine if a value is in an array.
# Usage: in_array [VALUE] [ARRAY] # Usage: if in_array "VALUE" "${ARRAY[@]}"; then ...
local value="$1"; shift local value="$1"; shift
for arrayItem in "$@"; do for arrayItem in "$@"; do
[[ "${arrayItem}" == "${value}" ]] && return 0 [[ "${arrayItem}" == "${value}" ]] && return 0
@@ -470,7 +465,6 @@ squeeze_lines() {
sed '/^[[:space:]]\+$/s/.*//g' | cat -s | trim_lines sed '/^[[:space:]]\+$/s/.*//g' | cat -s | trim_lines
} }
progressBar() { progressBar() {
# progressBar # progressBar
# ----------------------------------- # -----------------------------------
@@ -544,7 +538,6 @@ htmlEncode() {
echo "${1}" | sed -f "${SOURCEPATH}/htmlEncode.sed" echo "${1}" | sed -f "${SOURCEPATH}/htmlEncode.sed"
} }
urlencode() { urlencode() {
# URL encoding/decoding from: https://gist.github.com/cdown/1163649 # URL encoding/decoding from: https://gist.github.com/cdown/1163649
# Usage: urlencode <string> # Usage: urlencode <string>
@@ -745,7 +738,7 @@ function writeCSV() {
} }
function json2yaml { function json2yaml() {
# convert json files to yaml using python and PyYAML # convert json files to yaml using python and PyYAML
python -c 'import sys, yaml, json; yaml.safe_dump(json.load(sys.stdin), sys.stdout, default_flow_style=False)' < "$1" python -c 'import sys, yaml, json; yaml.safe_dump(json.load(sys.stdin), sys.stdout, default_flow_style=False)' < "$1"
} }