Thanks for taking the time to review my patch.
I agree with you that this change is not strictly required. It's more of a
nice to have / ergonomic improvement to the existing touch interface.
There are several StackOverflow posts that ask for this very feature:
On 6/14/22 19:20, Alan Rosenthal wrote:
`touch -p a/b/c/d/e` will now be the same as running:
`mkdir -p a/b/c/d && touch a/b/c/d/e`.
I don't see how this useful enough to merit a change, since one can
achieve the effect of the proposed "touch -p" with the already-existing
"mkdir -p" followed
`touch -p a/b/c/d/e` will now be the same as running:
`mkdir -p a/b/c/d && touch a/b/c/d/e`.
Added an option -p/--create-dirs to create any required directories.
Default behavior remains the same.
---
src/touch.c | 40 +++-
1 file changed, 39 insertions(+), 1
I don't like this as the default behavior. If this feature is added, it
should be optional, and enabled with -p, like mkdir.
David
`touch a/b/c/d/e` will now be the same as running `mkdir -p a/b/c/d &&
touch a/b/c/d/e`.
Added an option --no-create-dirs to not create any directories.
---
src/touch.c | 40 +++-
1 file changed, 39 insertions(+), 1 deletion(-)
diff --git a/src/touch.c
`touch a/b/c/d/e` will now be the same as running `mkdir -p a/b/c/d &&
touch a/b/c/d/e`.
Added an option --no-create-dirs to not create any directories.
---
src/touch.c | 39 ++-
1 file changed, 38 insertions(+), 1 deletion(-)
diff --git a/src/touch.c