I don't think you are doing something wrong.
You found a bug.
Apparently this command line function was never tested inside a v6 container. v6 container uses a different base image and uses a different grep
version.
EDIT:
There is already an open issue:
opened 05:35AM - 26 Oct 23 UTC
Bug: Confirmed
Pi-hole v6.0
### Versions
pihole:/# pihole -v
Pi-hole version is development-v6 a44e51b… (Latest: v5.17.2)
web version is development-v6 82f1965 (Latest: v5.20.2)
FTL version is development-v6 vDev-8664165 (Latest: v5.23)
### Platform
- Platform: Docker on Synology ds922+
### Expected behavior
Domain should be added to whitelist
### Actual behavior / bug
pihole:/# pihole -w site1.com
grep: unrecognized option: P
BusyBox v1.36.1 (2023-07-27 17:12:24 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
grep: unrecognized option: P
BusyBox v1.36.1 (2023-07-27 17:12:24 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
[✗] site1.com is not a valid argument or domain name!
### Steps to reproduce
Steps to reproduce the behavior:
Logon to docker CLI and try to add a domain to the whitelist.
Seems, that grep -P in list.sh in line 111/112 is not a possible option on Synology docker container.