From cdcdb977280d1acaae130a3937b3e85b67623b87 Mon Sep 17 00:00:00 2001 From: xyz Date: Thu, 9 Sep 2021 23:55:59 -0700 Subject: find change --execdir to --exec, --execdir not posix compliant? --- .local/bin/chmodef | 4 ++-- .local/bin/mvtr | 3 +-- .local/bin/orgext | 4 ++-- 3 files changed, 5 insertions(+), 6 deletions(-) diff --git a/.local/bin/chmodef b/.local/bin/chmodef index be9b2934..6836effd 100755 --- a/.local/bin/chmodef +++ b/.local/bin/chmodef @@ -1,5 +1,5 @@ #!/bin/sh # https://wiki.archlinux.org/title/File_permissions_and_attributes#Numeric_method -find "$@" -type d -execdir chmod 755 -- '{}' \+ -find "$@" -type f -execdir chmod 644 -- '{}' \+ +find "$@" -type d -exec chmod 755 -- '{}' \+ +find "$@" -type f -exec chmod 644 -- '{}' \+ diff --git a/.local/bin/mvtr b/.local/bin/mvtr index 7744da51..dcea8409 100755 --- a/.local/bin/mvtr +++ b/.local/bin/mvtr @@ -4,5 +4,4 @@ # link also show perl-rename approach # https://linuxconfig.org/rename-all-files-from-uppercase-to-lowercase-characters # if only change ' ' to '_' `rename` might be sufficient, for upper to lower case might need perl-rename if want concise -# shellcheck suggest use $1 for sh -c for better error messaging? see SC2156 -find "$@" -depth -execdir sh -c 'mv -nvT -- "$1" "$(echo "$1" | tr "[:upper:] " "[:lower:]_")"' sh '{}' \; +find "$@" -depth -exec sh -c 'mv -nvT -- "$1" "$(echo "$1" | tr "[:upper:] " "[:lower:]_")"' sh '{}' \; diff --git a/.local/bin/orgext b/.local/bin/orgext index 2ece9e72..88950928 100755 --- a/.local/bin/orgext +++ b/.local/bin/orgext @@ -8,7 +8,7 @@ outdir () { - find . -type f -execdir mv -nt "$PWD" -- '{}' \+ + find . -type f -exec mv -nt "$PWD" -- '{}' \+ find . -mindepth 1 -maxdepth 1 -type d -delete } @@ -17,7 +17,7 @@ outdir () indir () { find . -maxdepth 1 -type f | awk -F. '!a[$NF]++{print $NF}' | xargs mkdir -- - find . -mindepth 1 -maxdepth 1 -type d -execdir basename -az -- '{}' \+ | xargs -0 -I _ find . -maxdepth 1 -type f -name '*._' -execdir mv -t '_' -- '{}' \+ + find . -mindepth 1 -maxdepth 1 -type d -exec basename -az -- '{}' \+ | xargs -0 -I _ find . -maxdepth 1 -type f -name '*._' -exec mv -t '_' -- '{}' \+ } case "$1" in -- cgit v1.2.3-70-g09d2