1

From the fish manual:

[The File Descripter may be] an ampersand followed by a minus sign (&-). The file descriptor will be closed

From the Arch wiki:.

Silencing standard output: $ command > &-

From this I expected it to act like an alias for /dev/null, but quick experimentation on the command line reveals that this is not so:

$ echo hello >&-  
Error while writing to stdout
write_loop: Bad file descriptor

Also, oddly if we add a space before the & we get a a different error:

$ echo hello > &-
Expected a string, but instead found a '&'

What on earth is going on here? I'm running fish 2.2.0

1
  • 3
    The documentation that you quoted says it is closed. Writing to a closed file descriptor generates an error, which is reported (on the standard error of course - a different file descriptor). Commented Nov 1, 2015 at 20:48

0

You must log in to answer this question.

Browse other questions tagged .