Reputation: 600
In AIX, I tried to redirect both STDERR & STDOUT to /dev/null but the redirection doesn't seems to be happening. What might be the problem?
bash-3.2# /usr/sbin/lsgroup Test-Group | grep kbxb025 > /dev/null 2>&1
Group "Test-Group" does not exist.
Upvotes: 3
Views: 6824
Reputation: 36059
Redirections refer to commands, not whole pipelines. The outputs of grep
go into /dev/null
, but not those of lsgroup
. To solve these issues, group the pipeline into a subshell:
( /usr/sbin/lsgroup Test-Group | grep kbxb025; ) > /dev/null 2>&1
Upvotes: 6