-
-
Save atalazer/b488801fe82c60637de34f0ba2321caa to your computer and use it in GitHub Desktop.
Better way to create file or directory.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# ad | |
# Better way to create file or directory. | |
# Inspired by: | |
# - https://github.com/tanrax/terminal-AdvancedNewFile | |
# - https://github.com/NNBnh/mk | |
ad() { | |
mkfile() { | |
case "$1" in | |
*"/") | |
mkdir -p "$1" | |
;; | |
*) | |
mkdir -p "$(dirname "$1")" | |
touch "$1" | |
;; | |
esac | |
} | |
for file in "$@"; do | |
mkfile "$file" | |
done | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment