Skip to main content
Added additional info
Source Link
user56041
user56041

We are trying to find a way to craft a GNUmakefile that works on nearly all Unix compatibles. We were using egrep but it failed on MinGW. We switched to grep -E because it is Posix, but testing shows it is failing on Solaris 11.

A typical usage in the makefile is:

GREP ?= grep
...

IS_X86 := $(shell uname -m | $(GREP) -v "x86_64" | $(GREP) -i -c -E "i.86|x86|i86")
IS_X64 := $(shell uname -m | $(GREP) -i -c -E "(_64|d64)")

The result is:

grep: illegal option -- E
Usage: grep [-c|-l|-q] -bhinsvw pattern file . . .
grep: illegal option -- E
Usage: grep [-c|-l|-q] -bhinsvw pattern file . . .
...

I don't see where -E and -F are optional in Posix (perhaps I missed it). I found Difference between Solaris and POSIX on Stack Overflow, but it states, "Solaris has a full set of POSIX interfaces ...".

Its probably worth mentioning I run a [mostly] unmodified default shell to avoid polluting the test environment. My .bash_login adds /usr/local to the head of the list, but I don't have a grep in /usr/local/bin.

Why is Solaris' grep failing to consume -E? Is there a way to engage regular expression support on Solaris besides switching to egrep?


I just setup a fresh test account on the Solaris 11.3 machine to ensure I did not taint the environment.

The account was added with:

# useradd -d /export/home/test -m -s /bin/ksh -c "Testing Accoung" test

80 blocks

Inspecting PATH after logging in:

test@solaris:~$ echo $PATH
/usr/bin:/usr/sbin

We are trying to find a way to craft a GNUmakefile that works on nearly all Unix compatibles. We were using egrep but it failed on MinGW. We switched to grep -E because it is Posix, but testing shows it is failing on Solaris 11.

A typical usage in the makefile is:

GREP ?= grep
...

IS_X86 := $(shell uname -m | $(GREP) -v "x86_64" | $(GREP) -i -c -E "i.86|x86|i86")
IS_X64 := $(shell uname -m | $(GREP) -i -c -E "(_64|d64)")

The result is:

grep: illegal option -- E
Usage: grep [-c|-l|-q] -bhinsvw pattern file . . .
grep: illegal option -- E
Usage: grep [-c|-l|-q] -bhinsvw pattern file . . .
...

I don't see where -E and -F are optional in Posix (perhaps I missed it). I found Difference between Solaris and POSIX on Stack Overflow, but it states, "Solaris has a full set of POSIX interfaces ...".

Its probably worth mentioning I run a [mostly] unmodified default shell to avoid polluting the test environment. My .bash_login adds /usr/local to the head of the list, but I don't have a grep in /usr/local/bin.

Why is Solaris' grep failing to consume -E? Is there a way to engage regular expression support on Solaris besides switching to egrep?

We are trying to find a way to craft a GNUmakefile that works on nearly all Unix compatibles. We were using egrep but it failed on MinGW. We switched to grep -E because it is Posix, but testing shows it is failing on Solaris 11.

A typical usage in the makefile is:

GREP ?= grep
...

IS_X86 := $(shell uname -m | $(GREP) -v "x86_64" | $(GREP) -i -c -E "i.86|x86|i86")
IS_X64 := $(shell uname -m | $(GREP) -i -c -E "(_64|d64)")

The result is:

grep: illegal option -- E
Usage: grep [-c|-l|-q] -bhinsvw pattern file . . .
grep: illegal option -- E
Usage: grep [-c|-l|-q] -bhinsvw pattern file . . .
...

I don't see where -E and -F are optional in Posix (perhaps I missed it). I found Difference between Solaris and POSIX on Stack Overflow, but it states, "Solaris has a full set of POSIX interfaces ...".

Why is Solaris' grep failing to consume -E? Is there a way to engage regular expression support on Solaris besides switching to egrep?


I just setup a fresh test account on the Solaris 11.3 machine to ensure I did not taint the environment.

The account was added with:

# useradd -d /export/home/test -m -s /bin/ksh -c "Testing Accoung" test

80 blocks

Inspecting PATH after logging in:

test@solaris:~$ echo $PATH
/usr/bin:/usr/sbin
Add additional information.
Source Link
user56041
user56041

We are trying to find a way to craft a GNUmakefile that works on nearly all Unix compatibles. We were using egrep but it failed on MinGW. We switched to grep -E because it is Posix, but testing shows it is failing on Solaris 11.

A typical usage in the makefile is:

GREP ?= grep
...

IS_X86 := $(shell uname -m | $(GREP) -v "x86_64" | $(GREP) -i -c -E "i.86|x86|i86")
IS_X64 := $(shell uname -m | $(GREP) -i -c -E "(_64|d64)")

The result is:

grep: illegal option -- E
Usage: grep [-c|-l|-q] -bhinsvw pattern file . . .
grep: illegal option -- E
Usage: grep [-c|-l|-q] -bhinsvw pattern file . . .
...

I don't see where -E and -F are optional in Posix (perhaps I missed it).

  I found Difference between Solaris and POSIX on Stack Overflow, but it states, "Solaris has a full set of POSIX interfaces ...".

Its probably worth mentioning I run a [mostly] unmodified default shell to avoid polluting the test environment. My .bash_login adds /usr/local to the head of the list, but I don't have a grep in /usr/local/bin.

Why is Solaris' grep failing to consume -E? Is there a way to engage regular expression support on Solaris besides switching to egrep?

We are trying to find a way to craft a GNUmakefile that works on nearly all Unix compatibles. We were using egrep but it failed on MinGW. We switched to grep -E because it is Posix, but testing shows it is failing on Solaris 11.

A typical usage in the makefile is:

GREP ?= grep
...

IS_X86 := $(shell uname -m | $(GREP) -v "x86_64" | $(GREP) -i -c -E "i.86|x86|i86")
IS_X64 := $(shell uname -m | $(GREP) -i -c -E "(_64|d64)")

The result is:

grep: illegal option -- E
Usage: grep [-c|-l|-q] -bhinsvw pattern file . . .
grep: illegal option -- E
Usage: grep [-c|-l|-q] -bhinsvw pattern file . . .
...

I don't see where -E and -F are optional in Posix (perhaps I missed it).

  I found Difference between Solaris and POSIX on Stack Overflow, but it states, "Solaris has a full set of POSIX interfaces ...".

Why is Solaris' grep failing to consume -E? Is there a way to engage regular expression support on Solaris besides switching to egrep?

We are trying to find a way to craft a GNUmakefile that works on nearly all Unix compatibles. We were using egrep but it failed on MinGW. We switched to grep -E because it is Posix, but testing shows it is failing on Solaris 11.

A typical usage in the makefile is:

GREP ?= grep
...

IS_X86 := $(shell uname -m | $(GREP) -v "x86_64" | $(GREP) -i -c -E "i.86|x86|i86")
IS_X64 := $(shell uname -m | $(GREP) -i -c -E "(_64|d64)")

The result is:

grep: illegal option -- E
Usage: grep [-c|-l|-q] -bhinsvw pattern file . . .
grep: illegal option -- E
Usage: grep [-c|-l|-q] -bhinsvw pattern file . . .
...

I don't see where -E and -F are optional in Posix (perhaps I missed it). I found Difference between Solaris and POSIX on Stack Overflow, but it states, "Solaris has a full set of POSIX interfaces ...".

Its probably worth mentioning I run a [mostly] unmodified default shell to avoid polluting the test environment. My .bash_login adds /usr/local to the head of the list, but I don't have a grep in /usr/local/bin.

Why is Solaris' grep failing to consume -E? Is there a way to engage regular expression support on Solaris besides switching to egrep?

Source Link
user56041
user56041

Solaris grep and regular expressions?

We are trying to find a way to craft a GNUmakefile that works on nearly all Unix compatibles. We were using egrep but it failed on MinGW. We switched to grep -E because it is Posix, but testing shows it is failing on Solaris 11.

A typical usage in the makefile is:

GREP ?= grep
...

IS_X86 := $(shell uname -m | $(GREP) -v "x86_64" | $(GREP) -i -c -E "i.86|x86|i86")
IS_X64 := $(shell uname -m | $(GREP) -i -c -E "(_64|d64)")

The result is:

grep: illegal option -- E
Usage: grep [-c|-l|-q] -bhinsvw pattern file . . .
grep: illegal option -- E
Usage: grep [-c|-l|-q] -bhinsvw pattern file . . .
...

I don't see where -E and -F are optional in Posix (perhaps I missed it).

I found Difference between Solaris and POSIX on Stack Overflow, but it states, "Solaris has a full set of POSIX interfaces ...".

Why is Solaris' grep failing to consume -E? Is there a way to engage regular expression support on Solaris besides switching to egrep?