summaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorTitanSnow <[email protected]>2017-05-07 08:32:44 +0800
committerTitanSnow <[email protected]>2017-05-07 08:32:44 +0800
commit75344c5b27c0ce04f5e2e261382a00403d15bda9 (patch)
treeb4165e75b0eb7ea0001c94be7bada9f8f94cf2ed /scripts
parent74421dd37565851f41f7415c80fd7046227b40df (diff)
fix issues of "shellcheck"
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/get.sh16
1 files changed, 8 insertions, 8 deletions
diff --git a/scripts/get.sh b/scripts/get.sh
index 52a990dc7..01f59f790 100755
--- a/scripts/get.sh
+++ b/scripts/get.sh
@@ -12,7 +12,7 @@ echo ' /_/\_\_|_| |_|\__ \|_|\_\____| getter '
echo ' '
brew --version >/dev/null 2>&1 && brew install --HEAD xmake && xmake --version && exit
-if [ 0 -ne $(id -u) ]
+if [ 0 -ne "$(id -u)" ]
then
sudoprefix=sudo
else
@@ -31,7 +31,7 @@ my_exit(){
then
if [ $rv -eq 0 ];then rv=$2;fi
fi
- exit $rv
+ exit "$rv"
}
test_tools()
{
@@ -63,25 +63,25 @@ if [ 'x-b __local__' != "x$branch" ]
then
git clone --depth=1 $branch https://github.com/tboox/xmake.git /tmp/$$xmake_getter || my_exit 'Clone Fail'
else
- cp -r "$(git rev-parse --show-toplevel 2>/dev/null || hg root 2>/dev/null || echo $PWD)" /tmp/$$xmake_getter || my_exit 'Clone Fail'
+ cp -r "$(git rev-parse --show-toplevel 2>/dev/null || hg root 2>/dev/null || echo "$PWD")" /tmp/$$xmake_getter || my_exit 'Clone Fail'
fi
make -C /tmp/$$xmake_getter --no-print-directory build || my_exit 'Build Fail'
IFS=':'
patharr=($PATH)
prefix=
-for st in ${patharr[@]}
+for st in "${patharr[@]}"
do
if [[ "$st" = "$HOME"* ]]
then
- cwd=$(pwd)
+ cwd=$PWD
mkdir -p "$st"
- cd "$st"
+ cd "$st" || continue
echo $$ > $$xmake_getter_test 2>/dev/null || continue
rm $$xmake_getter_test 2>/dev/null || continue
- cd ..
+ cd .. || continue
mkdir -p share 2>/dev/null || continue
prefix=$(pwd)
- cd "$cwd"
+ cd "$cwd" || my_exit 'Chdir Error'
break
fi
done