Re: touch --create? (original) (raw)


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


From: Pádraig Brady
Subject: Re: touch --create?
Date: Tue, 19 Feb 2013 14:25:55 +0000
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:13.0) Gecko/20120615 Thunderbird/13.0.1

On 02/19/2013 01:39 PM, Bernhard Voelker wrote:

Sometimes, I want to create a file and want it to succeed only if the file wasn't previously there.

What about adding a complementary option to touch --no-create which could be used like this?

$ touch --create file
|| { echo "creating file failed" >&2; exit 1; }

I know the same could also be achieved with dd:

$ dd of=xx conv=excl status=none count=0
|| { echo "creating file failed" >&2; exit 1; }

but maybe it's worth adding to touch, too. WDYT?

One of those borderline ones. It was already discussed here: http://lists.gnu.org/archive/html/bug-coreutils/2011-10/msg00030.html The consensus for now being, alternatives suggested at that link, suffice.

thanks, Pádraig.