masonr / yet-another-bench-script

YABS - a simple bash script to estimate Linux server performance using fio, iperf3, & Geekbench
Do What The F*ck You Want To Public License
4.22k stars 430 forks source link

grep -P not available on Alpine Linux #59

Closed langfingaz closed 1 year ago

langfingaz commented 1 year ago

I Tried to run YABS on Alpine Linux but got the following error:

grep: unrecognized option: P
BusyBox v1.36.0 (2023-03-03 16:36:18 UTC) multi-call binary.

Usage: grep [-HhnlLoqvsrRiwFE] [-m N] [-A|B|C N] { PATTERN | -e PATTERN... | -f FILE... } [FILE]...

Search for PATTERN in FILEs (or stdin)

    -H  Add 'filename:' prefix
    -h  Do not add 'filename:' prefix
    -n  Add 'line_no:' prefix
    -l  Show only names of files that match
    -L  Show only names of files that don't match
    -c  Show only count of matching lines
    -o  Show only the matching part of line
    -q  Quiet. Return 0 if PATTERN is found, 1 otherwise
    -v  Select non-matching lines
    -s  Suppress open and read errors
    -r  Recurse
    -R  Recurse and dereference symlinks
    -i  Ignore case
    -w  Match whole words only
    -x  Match whole lines only
    -F  PATTERN is a literal (not regexp)
    -E  PATTERN is an extended regexp
    -m N    Match up to N times per file
    -A N    Print N lines of trailing context
    -B N    Print N lines of leading context
    -C N    Same as '-A N -B N'
    -e PTRN Pattern to match
    -f FILE Read pattern from file

This option is e.g. used in line 268:

https://github.com/masonr/yet-another-bench-script/blob/c4464c84f42b2a88f56736b668d323843d73857f/yabs.sh#L268

What do you think, is it worth to rewrite the script to use grep without the -P option?

masonr commented 1 year ago

Appreciate the bug report! That section was a recent addition, I'll try and get the grep -P commands replaced with something else.

masonr commented 1 year ago

resolved in dd110ee