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 @l0b0’s dotfiles (fix #330) #331

Merged
merged 1 commit into from
Feb 5, 2022
Merged

add @l0b0’s dotfiles (fix #330) #331

merged 1 commit into from
Feb 5, 2022

Conversation

LucasLarson
Copy link
Owner

there’s a POSIX-compliant way to find the number of files with a specific extension, even “hidden files, paths containing spaces, dashes and even newlines” (fix #330):123

extension="${1:-txt}"
command find -- . \
  -mindepth 1 \
  -name "*.${extension-}" \
  -exec printf x \; |
  command wc -c
unset extension

Footnotes

  1. Ask Ubuntu: Count total number of files in particular directory with specific extension

  2. Victor Engmark dotfiles: POSIX compatible safe file count

  3. Wikipedia: Fork (system call) § Importance of forking in Unix

count files with a specific extension, even “hidden files, paths containing spaces, dashes and even newlines”:

    extension="${1:-txt}"
    command find -- . \
      -mindepth 1 \
      -name "*.${extension-}" \
      -exec printf x \; |
      command wc -c
    unset extension

https://en.wikipedia.org/w/?oldid=556414409#Importance_of_forking_in_Unix
https://gitlab.com/victor-engmark/tilde/commit/94413fd483
https://askubuntu.com/a/454568
@LucasLarson LucasLarson added enhancement New feature or request submodules Pull requests that update Submodules code labels Feb 5, 2022
@LucasLarson LucasLarson merged commit 8a4bef1 into main Feb 5, 2022
@LucasLarson LucasLarson deleted the victor-engmark branch February 5, 2022 02:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request submodules Pull requests that update Submodules code
Projects
None yet
Development

Successfully merging this pull request may close these issues.

add @l0bo/@victor-catalyst/@victor-engmark dotfiles
1 participant