From: Steven Baltakatei Sandoval Date: Sat, 23 Jul 2022 07:44:56 +0000 (+0000) Subject: fix(user/bk-naut-hide):Comment out debug stderr X-Git-Tag: 0.5.1~13 X-Git-Url: https://zdv2.bktei.com/gitweb/BK-2020-03.git/commitdiff_plain/e2912511058c16ba658f02e34278c3c352d5b1ed fix(user/bk-naut-hide):Comment out debug stderr --- diff --git a/user/bk-naut-hide b/user/bk-naut-hide index 7f88e41..e623dcc 100755 --- a/user/bk-naut-hide +++ b/user/bk-naut-hide @@ -1,7 +1,7 @@ #!/usr/bin/env bash # Desc: Scan file system and update '.hidden' files to hide certain # files based on filenames. -# Version: 0.0.1 +# Version: 0.0.2 # Usage: bk-naut-hide [DIRS...] yell() { echo "$0: $*" >&2; } # print script path and all args to stderr @@ -188,40 +188,40 @@ main() { die "FATAL:Not a dir:arg:$arg"; fi; done; - yell "DEBUG:dirs_target:${dirs_target[*]}"; + #yell "DEBUG:dirs_target:${dirs_target[*]}"; # specify filename regex patterns to mark '.hidden' pat_tohide+=(".ots$"); pat_tohide+=(".ots.bak$"); - yell "DEBUG:pat_tohide:${pat_tohide[*]}"; + #yell "DEBUG:pat_tohide:${pat_tohide[*]}"; # generate list of paths of '.hidden' files for dir in "${dirs_target[@]}"; do - yell "DEBUG:generating list of paths of '.hidden' files in dir:$dir"; + #yell "DEBUG:generating list of paths of '.hidden' files in dir:$dir"; while read -r file; do ls_dothide_f+=("$file"); done < <(get_paths_dothide "$dir"); done; - yell "DEBUG:ls_dothide_f:${ls_dothide_f[*]}"; - yell "DEBUG:"; + #yell "DEBUG:ls_dothide_f:${ls_dothide_f[*]}"; + #yell "DEBUG:"; # get list of dirs containing the files while read -r line; do - yell "DEBUG:found .hidden file at:$line"; + #yell "DEBUG:found .hidden file at:$line"; dir="$(dirname "$line")"; ls_dothide_d+=("$dir"); done < <(printf "%s\n" "${ls_dothide_f[@]}") - yell "DEBUG:ls_dothide_d:${ls_dothide_d[*]}"; - yell "DEBUG:"; + #yell "DEBUG:ls_dothide_d:${ls_dothide_d[*]}"; + #yell "DEBUG:"; # for each dir, write list of files to hide in '.hidden' while read -r dir; do - yell "DEBUG:performing actions in dir:$dir"; + #yell "DEBUG:performing actions in dir:$dir"; declare -a ls_tohide_fn; # array for filenames to write in '.hidden' ## act on each file while read -r file; do - yell "DEBUG:considering file:$file"; + #yell "DEBUG:considering file:$file"; filename="$(basename "$file")"; ## check if file is actually a file @@ -240,16 +240,16 @@ main() { ## add file to list to add to '.hidden' if [[ $flag_pat_match == "true" ]]; then - yell "DEBUG:adding to ls_tohide_fn:file:$file": - yell "DEBUG:filename:$filename"; + #yell "DEBUG:adding to ls_tohide_fn:file:$file": + #yell "DEBUG:filename:$filename"; ls_tohide_fn+=("$filename"); fi; - yell "DEBUG:"; + #yell "DEBUG:"; ## unset variables defined only for this file unset filename flag_pat_match; done < <(find "$dir" -mindepth 1 -maxdepth 1 -type f 2>/dev/null); - yell "DEBUG:"; + #yell "DEBUG:"; ## add file names to $dir/'.hidden' ### remove blank lines and sort and uniq @@ -260,14 +260,14 @@ main() { ### write '.hidden' path_hidefile="$dir"/.hidden; - yell "DEBUG:Writing contents of .hidden file at path_hidefile:$path_hidefile"; - yell "DEBUG:ls_tohide_fn:$(printf "%s\n" "${ls_tohide_fn[@]}" )"; + #yell "DEBUG:Writing contents of .hidden file at path_hidefile:$path_hidefile"; + #yell "DEBUG:ls_tohide_fn:$(printf "%s\n" "${ls_tohide_fn[@]}" )"; printf "%s\n" "${ls_tohide_fn[@]}" > "$path_hidefile" ## unset variables defined only for this dir unset ls_tohide_fn path_hidefile; - yell "DEBUG:"; + #yell "DEBUG:"; done < <(printf "%s\n" "${ls_dothide_d[@]}"); }; # main program