0

If I run this command in a Linux shell:

echo 'hello world' &> /dev/null

I get no output, as expected. However, if I run:

sh -c "echo 'hello world' &> /dev/null"

It outputs hello world. Why is this? I thought that sh -c ran the given command inside a new shell; the given command should direct its output to /dev/null, leaving nothing to stdout for sh -c to return?

Jordan
  • 3,998
  • 9
  • 45
  • 81

0 Answers0