Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a magic mktouch function to bash/functions #95

Closed
benknoble opened this issue Aug 20, 2017 · 0 comments
Closed

Add a magic mktouch function to bash/functions #95

benknoble opened this issue Aug 20, 2017 · 0 comments

Comments

@benknoble
Copy link
Owner

cf. this SO question and the answer I like

Basically, the function is this:

mktouch() {
    if [ $# -lt 1 ]; then
        echo "Missing argument";
        return 1;
    fi

    for f in "$@"; do
        mkdir -p -- "$(dirname -- "$f")"
        touch -- "$f"
    done
}
@benknoble benknoble added the bash label Aug 20, 2017
@benknoble benknoble added this to the Version 1.4 milestone Aug 20, 2017
@benknoble benknoble self-assigned this Aug 20, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant