Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

3
  • 2
    That's quite inefficient compared to command "$x" </dev/null. echo "" | requires a fork(), a mkfifo(), etc; and it moves command out-of-process, so even if it's a shell function, it can't set variables that persist outside the loop. Commented Aug 8, 2019 at 22:56
  • 1
    This solved my problem. In my case, using echo "" | for some reason made me unable to print the result of the command to stdout. Using @CharlesDuffy's </dev/null worked. Commented Apr 14, 2022 at 1:59
  • Also worked with sudo when running a command that eats input. Thanks! Commented Sep 7, 2022 at 9:57