[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#24599: Cannot process files named -
From: |
Assaf Gordon |
Subject: |
bug#24599: Cannot process files named - |
Date: |
Mon, 3 Oct 2016 15:40:38 -0400 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.3.0 |
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