tag 21065 notabug
thanks

On 07/15/2015 07:25 AM, Rickard Norlander wrote:
> touch version 8.23
> 
> Command:
> $ touch -- '-'
> Happens:
> Returns successfully, but no file is created (if file exists, timestamp is
> not updated)

Like many other tools, '-' is special-cased in touch to mean operation
on stdin:

$ touch --help | grep -A1 ' - '
A FILE argument string of - is handled specially and causes touch to
change the times of the file associated with standard output.

So you successfully touched stdin (in your case, /dev/tty).  If you want
to create a file named '-', use 'touch ./-'.

See also this FAQ:
https://www.gnu.org/software/coreutils/faq/coreutils-faq.html#How-do-I-remove-files-that-start-with-a-dash_003f

-- 
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org

Attachment: signature.asc
Description: OpenPGP digital signature

Reply via email to