[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH] cat: open any file name after "--"
From: |
Eric Blake |
Subject: |
Re: [PATCH] cat: open any file name after "--" |
Date: |
Fri, 5 Jul 2019 23:48:17 -0500 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.7.0 |
On 7/5/19 11:31 PM, Eric Blake wrote:
> If you wish to cat a file named '-' in the current directory, spell it
> './-' or use an absolute path to that file. That's true of all command
> line utilities that treat '-' as stdin (not just cat).
For more fun, go figure out why:
grep - - --
grep [---]
behave the same, regardless of whether you have a file named '-' in your
current working directory (unless you use shopt -s failglob). And the
rule on using ./- for a file in the current directory also applies to
touch, except there '-' means stdout instead of stdin.
--
Eric Blake, Principal Software Engineer
Red Hat, Inc. +1-919-301-3226
Virtualization: qemu.org | libvirt.org
signature.asc
Description: OpenPGP digital signature