It is not the awk command causing issues, but the pattern you're using with grep.
An unquoted parenthesis is special to the shell. It introduces a sub-shell, but in the context that you're using it, it makes no sense, hence the syntax error.
Therefore, the text Cpu(s) must be quoted as 'Cpu(s)'. If you intend for this to be a piece of literal string you want to search for, you should ideally also use grep with its -F option. This stops grep from interpreting the pattern as a regular expression.
However, using grep together with awk is almost always unnecessary, as awk is perfectly well equipped to do the same thing:
cpu_info () { top -b -n 1 | awk '/Cpu\(s\s)/ { print $2 + $4 }' } Here, I escape boththe ( and ) to interpret themit as a literal parenthesesleft parenthesis and not as the start of a grouping of a sub-expression.