I found this question while searching for a specific problem with which I linked the command using the <command , which used the interleaving operator in a regular expression, so I thought I would make my more specialized answer.
The error I encountered turned out to be with the previous pipe operator (ie | ), and not with the rotation parameter (ie | identical to the pipe operator) in the general grep expression. The answer for me was to escape correctly and specify special shell characters, such as & , if necessary, before assuming that the problem is with my medium regular expression grep interleave operator.
For example, the command that I ran on my local machine was:
get http://localhost/foobar-& | grep "fizz\|buzz"
This command resulted in the following error:
-bash: syntax error near unexpected token `|'
This error was fixed by changing my command to:
get "http://localhost/foobar-&" | grep "fizz\|buzz"
By holding the & character with double quotes, I was able to solve the problem. The answer had nothing to do with the rotation operation.
entpnerd Feb 08 '17 at 0:33 2017-02-08 00:33
source share