Reputation: 619
In a for loop i used eval statement. But it is throwing logs on console for non matching patterns. I tried redirecting the eval cmd o/p to null as below.But its not working.
for loop ..
do
..
temp=eval "$tempVal"
>/dev/null 2>&1
..
done
Any other way to handle this? Any help would be really appreciated.
Upvotes: 2
Views: 1847
Reputation: 123708
You seem to be attempting redirection after assigning eval
output to a variable. You need to say:
temp=`eval "$tempVal" 2>/dev/null`
instead. Moreover, consider using $(...)
instead of backticks:
temp=$(eval "$tempVal" 2>/dev/null)
Upvotes: 4