Skip to main content
10 events
when toggle format what by license comment
May 7, 2021 at 10:18 comment added Gilles 'SO- stop being evil' @Xerus Sometimes. It isn't the same thing, but in some circumstances it has the same effect. >/dev/null redirects the file descriptor whereas >- closes it. If the application tries to write and ignores write failures, this has the same effect. If the application exits on write failures, this likely doesn't have the same effect. If the application opens a file and it lands on that descriptor, this could have a completely different effect, e.g. ending up writing log messages to the file intended for normal output.
May 7, 2021 at 10:15 comment added xeruf I'm a bit confused about - - can I use >- in place of >/dev/null?
Jun 4, 2020 at 19:47 comment added Gilles 'SO- stop being evil' @rexkogitans No, it's about >&, but I see how it could be hard to follow. I've reworded the last two paragraphs.
Jun 4, 2020 at 19:46 history edited Gilles 'SO- stop being evil' CC BY-SA 4.0
added 341 characters in body
Jun 4, 2020 at 19:36 comment added rexkogitans In the last paragraph, shouldn't it read &> filename?
Jun 4, 2020 at 14:14 comment added Ismael Miguel @TooTea As I said, you use nul to redirect the output stream, not to close it. nul is the same as /dev/null. From what I've seen, there's no file descriptor closing. ss64.com/nt/syntax-redirection.html <-- should give you a better light on what I mean
Jun 4, 2020 at 14:01 comment added TooTea @IsmaelMiguel Watch out. Does redirection to NUL actually close the fd (thus return errors on I/O, like 2>-), or just discard writes/return EOF on reads (like 2>/dev/null)?
Jun 4, 2020 at 10:23 comment added Ismael Miguel Interestingly enough, the POSIX-compliant way (>file.txt 2>&1) also works for Windows' command line. However, instead of - to close the file descriptor, you redirect to nul (same as /dev/null).
Jun 3, 2020 at 19:36 vote accept ExecutionByFork
Jun 3, 2020 at 19:00 history answered Gilles 'SO- stop being evil' CC BY-SA 4.0