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

Resolve compatibility issues #627

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

Resolve compatibility issues #627

wants to merge 1 commit into from

Conversation

Demired
Copy link

@Demired Demired commented Feb 18, 2025

top -b -n 1 | grep Cpu | awk -F ":" '{print $2}'

在一些场景中,会得到这样的结果

[root@myserver ~]# top -b -n 1 | grep Cpu | awk -F ":" '{print $2}'
 16.1 us,  2.0 sy,  0.0 ni, 80.2 id,  0.0 wa,  0.2 hi,  1.5 si,  0.0 st
00.00 grep --color=auto Cpu

而非预想的

[root@tuo-3-201 ~]# top -b -n 1 | grep Cpu | awk -F ":" '{print $2}'
 16.1 us,  2.0 sy,  0.0 ni, 80.2 id,  0.0 wa,  0.2 hi,  1.5 si,  0.0 st

如果使用

top -b -n 1 | grep [C]pu | awk -F ":" '{print $2}'

就能完美解决

@codecov-commenter
Copy link

codecov-commenter commented Feb 18, 2025

⚠️ Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 89.36%. Comparing base (eef3a25) to head (70f1f54).
Report is 107 commits behind head on main.

❗ Your organization needs to install the Codecov GitHub app to enable full functionality.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #627      +/-   ##
==========================================
- Coverage   98.80%   89.36%   -9.44%     
==========================================
  Files          85       93       +8     
  Lines        5867     6547     +680     
==========================================
+ Hits         5797     5851      +54     
- Misses         51      667     +616     
- Partials       19       29      +10     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@suchen-sci
Copy link
Contributor

Hi,

Thanks for your contribution. But it seems top -b -n 1 | grep [C]pu | awk -F ":" '{print $2}' does not work in zsh, please update it to top -b -n 1 | grep "[C]pu" | awk -F ":" '{print $2}'.

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

Successfully merging this pull request may close these issues.

3 participants