Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

为何执行不过去呢?脚本需要什么参数吗 #57

Closed
wanghaile opened this issue Aug 31, 2017 · 3 comments
Closed

为何执行不过去呢?脚本需要什么参数吗 #57

wanghaile opened this issue Aug 31, 2017 · 3 comments

Comments

@wanghaile
Copy link

wanghaile commented Aug 31, 2017

➜  useful-scripts git:(release) sh show-busy-java-threads.sh  -c 10
head: illegal option -- -
usage: head [-n lines | -c bytes] [file ...]
@oldratlee
Copy link
Owner

oldratlee commented Sep 1, 2017

show-busy-java-threads.sh不支持Mac系统,原因是:

Mac下ps命令不能列出线程信息,在Mac下实现不了。更多信息参见 #33

PS

不要自己去指定sh的方式去执行脚本 @wanghaile (这个是坏习惯 😄 ) :

  1. 脚本已经是可执行的,操作更简单些。
    • 在里面指定的是bash
    • 脚本中总是指定上确定的shell(如bash)是最佳实践: #!/bin/bash
  2. 不同的shell(sh、bash、zsh、fish、csh、tcsh、ksh、ash、dash……)有各种差异,深坑勿入
  3. sh可能是个符号链接,可能链接到不同的shell,如有的Ubuntu版本,sh是链接到dash的。

推荐直接执行的方式:

wget https://github.com/oldratlee/useful-scripts/raw/dev-2.x/bin/show-busy-java-threads
chmod +x show-busy-java-threads
./show-busy-java-threads

PPS

上面出错的信息是指,machead命令 不支持--lines选项。

@wanghaile
Copy link
Author

好的,谢谢指点

@oldratlee
Copy link
Owner

oldratlee commented Sep 3, 2017

在文档中,加上了 脚本支持系统的说明信息。 @wanghaile 谢谢建议 😸

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants