bug#9742: touch option for existence? (original) (raw)
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
From: | Morty |
---|---|
Subject: | bug#9742: touch option for existence? |
Date: | Wed, 12 Oct 2011 21:45:25 -0400 |
User-agent: | Mutt/1.5.20 (2009-06-14) |
[This is more of a feature request than a bug request. But I don't see where I can make feature requests.]
It would be nice if touch had an option to only "touch" if the file doesn't already exist. Sort of like -c, but the other way around. This is useful because often, the reason one is using "touch" in a script is because one wants to make sure that a file exists before doing an operation that expects the file to already exist. But if the file already exists, then touch has a side effect of changing the mtime or the atime. [On many systems, one can work on a file without changing the atime thanks to mount options such as noatime or relatime.]
It's easy enough to wrap touch in an if:
if [ ! -e file];thentouchfile ]; then touch file];thentouchfile; fi
But it would be nicer if this common case were built in. I would suggest -e, for exists. Thanks!
- Morty
- bug#9742: touch option for existence?,Morty <=
- bug#9742: touch option for existence?, Pádraig Brady, 2011/10/13
* bug#9742: touch option for existence?, Morty, 2011/10/13
* bug#9742: touch option for existence?, Jim Meyering, 2011/10/13
* bug#9742: touch option for existence?, Paul Eggert, 2011/10/13
* bug#9742: touch option for existence?, Eric Blake, 2011/10/13
- bug#9742: touch option for existence?, Pádraig Brady, 2011/10/13
- Prev by Date:bug#9740: Bug in sort
- Next by Date:bug#9742: touch option for existence?
- Previous by thread:bug#9740: Bug in sort
- Next by thread:bug#9742: touch option for existence?
- Index(es):