Sample Header Ad - 728x90

awk inside function causing errors

-1 votes
1 answer
92 views
I'm trying to add the following to my .bashrc: cpu_info() { top -b -n1 | grep Cpu(s) | awk '{print $2 + $4}' } but bash is telling me: bash: .bashrc: line 131: syntax error near unexpected token `(' bash: .bashrc: line 131: ` top -b -n1 | grep Cpu(s) | awk '{print $2 + $4}'' the command works fine in the terminal, not sure why its breaking in my bash script any ideas?
Asked by Mathew (243 rep)
May 10, 2024, 04:47 PM
Last activity: May 11, 2024, 05:00 AM