[Top][All Lists]

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

touch --create?

From: Bernhard Voelker
Subject: touch --create?
Date: Tue, 19 Feb 2013 14:39:31 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130105 Thunderbird/17.0.2

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.

Have a nice day,

reply via email to

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