Skip to content

Instantly share code, notes, and snippets.

@fenollp
Created March 30, 2020 15:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save fenollp/47626279396874711e5d399cb3255162 to your computer and use it in GitHub Desktop.
Save fenollp/47626279396874711e5d399cb3255162 to your computer and use it in GitHub Desktop.
macOS (BSD) `grep` bug (incompatibility) when using `-mX` with `-Ay` (but not with `-By` nor `-Cy`)
grep --version && uname -v
# grep (BSD grep) 2.5.1-FreeBSD
# Darwin Kernel Version 19.4.0: Wed Mar 4 22:28:40 PST 2020; root:xnu-6153.101.6~15/RELEASE_X86_64
grep -A1 -E "urls = \[" */WORKSPACE
# example_http_archive_locked/WORKSPACE: urls = [
# example_http_archive_locked/WORKSPACE- "https://github.com/bazelbuild/bazel-skylib/releases/download/0.8.0/bazel-skylib.0.8.0.tar.gz",
#but:
grep -m1 -A1 -E "urls = \[" */WORKSPACE
# example_http_archive_locked/WORKSPACE: urls = [
#whereas:
grep -m1 -C1 -E "urls = \[" */WORKSPACE
# example_http_archive_locked/WORKSPACE- type = "tar.gz",
# example_http_archive_locked/WORKSPACE: urls = [
#and on Linux:
grep -m1 -A1 -E "urls = \[" */WORKSPACE
# example_http_archive_locked/WORKSPACE: urls = [
# example_http_archive_locked/WORKSPACE- "https://github.com/bazelbuild/bazel-skylib/releases/download/0.8.0/bazel-skylib.0.8.0.tar.gz",
#also on Linux:
grep --version
# grep (GNU grep) 2.27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment