Skip to content

Instantly share code, notes, and snippets.

@devinivy
Created January 15, 2016 21:13
Show Gist options
  • Save devinivy/50d7f6b1102e55e017dc to your computer and use it in GitHub Desktop.
Save devinivy/50d7f6b1102e55e017dc to your computer and use it in GitHub Desktop.
Create all necessary dirs while touching a file
# from http://unix.stackexchange.com/a/168582
supertouch() {
for p in "$@"; do
_dir="$(dirname -- "$p")"
[ -d "$_dir" ] || mkdir -p -- "$_dir"
touch -- "$p"
done
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment