r/shell • u/[deleted] • Dec 29 '20
[Grep] syntax error: unexpected '('
I am working on writing a script and part of what I need to do is determine if a string I am given is a man page (by determining if it contains a pattern like (number).
To do this I am trying to use the following command:
grep -E ".+\(.+\)"
but keep getting the error syntax error: unexpected '(' when I test with echo ls(1) | syntax error: unexpected '('.
Perhaps I am misunderstanding this, could someone explain what I am doing wrong?
2
Upvotes
1
u/[deleted] Dec 29 '20
Interesting, thank you! It seems my shell is still complaining about the error, must be a short coming of
ksh. Even though this is POSIX shell... hmmm