From b131781b39327ba4f31124ef5f379dd6618166fa Mon Sep 17 00:00:00 2001 From: Joseph Werle Date: Sun, 25 May 2014 19:22:12 -0400 Subject: [PATCH] enhance install --- lib/install/install.sh | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/lib/install/install.sh b/lib/install/install.sh index 0501143..3a03637 100755 --- a/lib/install/install.sh +++ b/lib/install/install.sh @@ -196,11 +196,16 @@ bpkg_install () { ## construct scripts array { - scripts=$(echo -n $json | bpkg-json -b | grep 'scripts' | awk '{ print $2 }' | tr -d '"') + scripts=$(echo -n $json | bpkg-json -b | grep 'scripts' | awk '{$1=""; print $0 }' | tr -d '"') OLDIFS="${IFS}" + + ## comma to space IFS=',' - scripts=($(echo ${scripts})) + scripts=($(echo ${scripts[@]})) IFS="${OLDIFS}" + + ## account for existing space + scripts=($(echo ${scripts[@]})) } ## build global if needed @@ -231,7 +236,14 @@ bpkg_install () { fi elif [ "${#scripts[@]}" -gt "0" ]; then ## get package name from `package.json' - name="$(echo -n ${json} | bpkg-json -b | grep 'name' | awk '{ print $2 }' | tr -d '\"')" + name="$( + echo -n ${json} | + bpkg-json -b | + grep 'name' | + awk '{ $1=""; print $0 }' | + tr -d '\"' | + tr -d ' ' + )" ## make `deps/' directory if possible mkdir -p "${cwd}/deps/${name}"