diff options
author | xyz <gky44px1999@gmail.com> | 2021-10-05 17:46:08 -0700 |
---|---|---|
committer | xyz <gky44px1999@gmail.com> | 2021-10-05 17:46:08 -0700 |
commit | d48212d1ac503ad42ca403400c399efeb9f76a39 (patch) | |
tree | 892f03c07dd40d8a77cc34f33fc066f6545dea09 | |
parent | 3161b11eda69fffb25bd0fc084dcf8a0052c6d82 (diff) |
refactor
-rwxr-xr-x | .local/bin/mvtr | 1 | ||||
-rwxr-xr-x | .local/bin/upd | 2 |
2 files changed, 3 insertions, 0 deletions
diff --git a/.local/bin/mvtr b/.local/bin/mvtr index 9f0f680d..a4fa90a0 100755 --- a/.local/bin/mvtr +++ b/.local/bin/mvtr @@ -7,6 +7,7 @@ # pass awk script as argument trick from url: # https://unix.stackexchange.com/questions/282503/right-syntax-for-awk-usage-in-combination-with-other-command-inside-xargs-sh-c +# -exec can't replace -execdir here, see cli notes for the -exec way find "$@" -depth -execdir sh -c 'mv -nvT -- "$2" "$(echo "$2" | awk "$1" )"' shell '{gsub(/\/-+/,"/");gsub(/ +/,"_");gsub(/_*-+_*/,"-");print tolower($0)}' '{}' \; # for test diff --git a/.local/bin/upd b/.local/bin/upd index edf9ccd7..d48cd839 100755 --- a/.local/bin/upd +++ b/.local/bin/upd @@ -36,7 +36,9 @@ misc () sudo hardcode-fixer nsxiv -c # my ways + # -exec can't replace -execdir here find "$XDG_CACHE_HOME/nsxiv/" -depth -type d -empty -execdir rmdir -- '{}' \+ + # -exec can replace -execdir here #find "$XDG_CACHE_HOME/nsxiv/" -depth -type d -execdir rmdir --ignore-fail-on-non-empty -- '{}' \+ # nsxiv man page way #find "$XDG_CACHE_HOME/nsxiv/" -depth -type d -empty ! -name '.' -exec rmdir -- '{}' \; |