bug-coreutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#21065: Small bug in touch


From: Eric Blake
Subject: bug#21065: Small bug in touch
Date: Wed, 15 Jul 2015 09:31:05 -0600
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.0.1

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

[Prev in Thread] Current Thread [Next in Thread]