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