diff --git a/agent/src/main/java/com/taobao/arthas/agent/AgentBootstrap.java b/agent/src/main/java/com/taobao/arthas/agent/AgentBootstrap.java index 8cc68d96..adbba79d 100644 --- a/agent/src/main/java/com/taobao/arthas/agent/AgentBootstrap.java +++ b/agent/src/main/java/com/taobao/arthas/agent/AgentBootstrap.java @@ -100,7 +100,7 @@ public class AgentBootstrap { args = decodeArg(args); int index = args.indexOf(';'); String agentJar = args.substring(0, index); - final String agentArgs = args.substring(index, args.length()); + final String agentArgs = args.substring(index); File agentJarFile = new File(agentJar); if (!agentJarFile.exists()) { diff --git a/bin/install.sh b/bin/install.sh index 46cd0488..e2c77ba6 100644 --- a/bin/install.sh +++ b/bin/install.sh @@ -22,9 +22,9 @@ exit_on_err() } # check permission to download && install -[ ! -w ./ ] && exit_on_err 1 "permission denied, target directory ./ was not writable." +[[ ! -w ./ ]] && exit_on_err 1 "permission denied, target directory ./ was not writable." -if [ $# -gt 1 ] && [ $1 = "--url" ]; then +if [[ $# -gt 1 ]] && [[ $1 = "--url" ]]; then shift ARTHAS_FILE_URL=$1 shift @@ -35,14 +35,14 @@ echo "downloading... ${TEMP_ARTHAS_FILE}" curl \ -sLk \ --connect-timeout ${SO_TIMEOUT} \ - $ARTHAS_FILE_URL \ + ${ARTHAS_FILE_URL} \ -o ${TEMP_ARTHAS_FILE} \ || exit_on_err 1 "download failed!" -# wirte or overwrite local file +# write or overwrite local file rm -rf as.sh mv ${TEMP_ARTHAS_FILE} ${TARGET_ARTHAS_FILE} chmod +x ${TARGET_ARTHAS_FILE} # done -echo "Arthas install successed." +echo "Arthas install succeeded." diff --git a/boot/src/main/java/com/taobao/arthas/boot/Bootstrap.java b/boot/src/main/java/com/taobao/arthas/boot/Bootstrap.java index 60eb01af..3e9d0809 100644 --- a/boot/src/main/java/com/taobao/arthas/boot/Bootstrap.java +++ b/boot/src/main/java/com/taobao/arthas/boot/Bootstrap.java @@ -76,7 +76,7 @@ public class Bootstrap { *
* The directory contains arthas-core.jar/arthas-client.jar/arthas-spy.jar. * 1. When use-version is not empty, try to find arthas home under ~/.arthas/lib - * 2. Try set the directory where arthas-boot.jar is located to arhtas home + * 2. Try set the directory where arthas-boot.jar is located to arthas home * 3. Try to download from maven repo **/ @@ -524,7 +524,7 @@ public class Bootstrap { private static void verifyArthasHome(String arthasHome) { File home = new File(arthasHome); if (home.isDirectory()) { - String fileList[] = { "arthas-core.jar", "arthas-agent.jar", "arthas-spy.jar" }; + String[] fileList = { "arthas-core.jar", "arthas-agent.jar", "arthas-spy.jar" }; for (String fileName : fileList) { if (!new File(home, fileName).exists()) {