2

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
2
  • 1
    unix.stackexchange.com/questions/23964/… Commented Aug 22, 2015 at 11:25
  • None of these work either.$echo "core_%e.%p" > /proc/sys/kernel/core_pattern 2>&1 1> /dev/null $ echo "core_%e.%p" > /proc/sys/kernel/core_pattern 1> /dev/null 2>&1 $ echo "core_%e.%p" > /proc/sys/kernel/core_pattern > /dev/null 2>&1 Commented Aug 22, 2015 at 11:31

2 Answers 2

1

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.

Sign up to request clarification or add additional context in comments.

Comments

0

works too:

bash -c 'echo "core_%e.%p" > /proc/sys/kernel/core_pattern' > /dev/null 2>&1

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.