Reputation: 61
Why doesn't the output get redirected in this case. The user doesn't have permission to write in /proc hence the error but why the error isn't going to /dev/null?
$echo "core_%e.%p" > /proc/sys/kernel/core_pattern 2>&1 > /dev/null
-bash: /proc/sys/kernel/core_pattern: Permission denied
Upvotes: 2
Views: 233
Reputation: 3519
Try with:
echo "core_%e.%p" 2>/dev/null > /proc/sys/kernel/core_pattern 2>&1
that will send stdout and stderr to "core_pattern", if possible, if not, ends without message.
Upvotes: 1
Reputation: 61
works too:
bash -c 'echo "core_%e.%p" > /proc/sys/kernel/core_pattern' > /dev/null 2>&1
Upvotes: 0