Repository: vuejs/vue
Pull request: Clean shell scripts

Hi,

I fixed various things spotted by shellcheck.

**What kind of change does this PR introduce?** (check at least one)

- [ ] Bugfix
- [ ] Feature
- [x] Code style update
- [ ] Refactor
- [ ] Build-related changes
- [ ] Other, please describe:

**Does this PR introduce a breaking change?** (check one)

- [ ] Yes
- [x] No

If yes, please describe the impact and migration path for existing applications:

**The PR fulfills these requirements:**

- [x] It's submitted to the `dev` branch for v2.x (or to a previous version branch), _not_ the `master` branch
- [x] When resolving a specific issue, it's referenced in the PR's title (e.g. `fix #xxx[,#xxx]`, where "xxx" is the issue number)
- [x] All tests are passing: https://github.com/vuejs/vue/blob/dev/.github/CONTRIBUTING.md#development-setup
- [x] New/updated tests are included


Changed files:
filename: scripts/release-weex.sh
patch: @@ -1,6 +1,7 @@
+#!/bin/bash
 set -e
-CUR_VERSION=`node build/get-weex-version.js -c`
-NEXT_VERSION=`node build/get-weex-version.js`
+CUR_VERSION=$(node build/get-weex-version.js -c)
+NEXT_VERSION=$(node build/get-weex-version.js)
 
 echo "Current: $CUR_VERSION"
 read -p "Enter new version ($NEXT_VERSION): " -n 1 -r
@@ -20,15 +21,16 @@ if [[ $REPLY =~ ^[Yy]$ ]]; then
   WEEX_VERSION=$NEXT_VERSION npm run build:weex
 
   # update package
-  cd packages/weex-vue-framework
-  npm version $NEXT_VERSION
+  # using subshells to avoid having to cd back
+  ( cd packages/weex-vue-framework
+  npm version "$NEXT_VERSION"
   npm publish
-  cd -
+  )
 
-  cd packages/weex-template-compiler
-  npm version $NEXT_VERSION
+  ( cd packages/weex-template-compiler
+  npm version "$NEXT_VERSION"
   npm publish
-  cd -
+  )
 
   # commit
   git add packages/weex*

filename: scripts/release.sh
patch: @@ -1,8 +1,9 @@
+#!/bin/bash
 set -e
 
 if [[ -z $1 ]]; then
   echo "Enter new version: "
-  read VERSION
+  read -r VERSION
 else
   VERSION=$1
 fi
@@ -32,23 +33,24 @@ if [[ $REPLY =~ ^[Yy]$ ]]; then
   VERSION=$VERSION npm run build
 
   # update packages
-  cd packages/vue-template-compiler
-  npm version $VERSION
+  # using subshells to avoid having to cd back
+  ( ( cd packages/vue-template-compiler
+  npm version "$VERSION"
   if [[ -z $RELEASE_TAG ]]; then
     npm publish
   else
-    npm publish --tag $RELEASE_TAG
+    npm publish --tag "$RELEASE_TAG"
   fi
-  cd -
+  )
 
   cd packages/vue-server-renderer
-  npm version $VERSION
+  npm version "$VERSION"
   if [[ -z $RELEASE_TAG ]]; then
     npm publish
   else
-    npm publish --tag $RELEASE_TAG
+    npm publish --tag "$RELEASE_TAG"
   fi
-  cd -
+  )
 
   # commit
   git add -A
@@ -63,14 +65,14 @@ if [[ $REPLY =~ ^[Yy]$ ]]; then
   # generate release note
   npm run release:note
   # tag version
-  npm version $VERSION --message "build: release $VERSION"
+  npm version "$VERSION" --message "build: release $VERSION"
 
   # publish
-  git push origin refs/tags/v$VERSION
+  git push origin refs/tags/v"$VERSION"
   git push
   if [[ -z $RELEASE_TAG ]]; then
     npm publish
   else
-    npm publish --tag $RELEASE_TAG
+    npm publish --tag "$RELEASE_TAG"
   fi
 fi