Changes logic to create array from JSON sections in bpkg-install.

pull/102/head
Ben Peachey 6 years ago committed by Joseph Werle
parent d0df4f28f1
commit 0b21ee1b21

@ -347,30 +347,24 @@ bpkg_install_from_remote () {
## construct scripts array
{
scripts=$(echo -n "${json}" | bpkg-json -b | grep '\["scripts' | awk '{$1=""; print $0 }' | tr -d '"')
OLDIFS="${IFS}"
scripts=$(echo -n "${json}" | bpkg-json -b | grep '\["scripts' | awk '{ print $2 }' | tr -d '"')
## comma to space
IFS=','
scripts=("${scripts[@]}")
## create array by splitting on newline
OLDIFS="${IFS}"
IFS=$'\n'
scripts=(${scripts[@]})
IFS="${OLDIFS}"
## account for existing space
scripts=("${scripts[@]}")
}
## construct files array
{
files=$(echo -n "${json}" | bpkg-json -b | grep '\["files' | awk '{$1=""; print $0 }' | tr -d '"')
OLDIFS="${IFS}"
files=$(echo -n "${json}" | bpkg-json -b | grep '\["files' | awk '{ print $2 }' | tr -d '"')
## comma to space
IFS=','
files=("${files[@]}")
## create array by splitting on newline
OLDIFS="${IFS}"
IFS=$'\n'
files=(${files[@]})
IFS="${OLDIFS}"
## account for existing space
files=("${files[@]}")
}
fi

Loading…
Cancel
Save