tag 24599 notabug
close 24599
stop

Hello,

On 10/03/2016 02:12 PM, João Miguel wrote:
I initially thought this was not a bug (found no report about this in
these mailing lists while searching for «file named ""-""»), but it
works as expected with vi ("vi -" tries to read stdin, "vi -- -" edits
the file named -).

This behavior is by designed and is required by the POSIX standard:
http://pubs.opengroup.org/onlinepubs/9699919799/utilities/cat.html

    "[...] If a file is '-', the cat utility shall read from the standard input 
at
    that point in the sequence. [...]"

To read a file named '-' in the current directory, use:

    cat ./-

Treating '-' as STDIN allows usage such as:

    other-program | cat FILE1 - FILE2

The output of 'other-program' between FILE1 and FILE2.

The usage of '--' simply means that the rest of the parameters
are not program-options, and this works the same:

    other-program | cat -- FILE1 - FILE2

As such, I'm marking this as 'not a bug' and closing it,
but discussion can continue by replying to this thread.

regards,
 - assaf



Reply via email to