@mcc This inspired me to write and test a somewhat robust shellscript function for inclusion in ~/.shrc or ~/.bashrc:
touchp() { for file in "$@"; do mkdir -p "$( dirname "$file" )" && touch "$file"; done; }
@nico @mcc I relied on https://pubs.opengroup.org/onlinepubs/9699919799/utilities/dirname.html for availability.
That noted, "${file%/*}" is both faster and more elegant. I like it. (It does fail silently and probably bad if a pathname ends with a slash, though.)
@arielmt @mcc OMG. I have to retract my previous statement and call myself old. It wasn't there last time I checked, I swear!