diff --git a/.config/bash/module/archive.sh b/.config/bash/module/archive.sh index 6494017..79be19b 100644 --- a/.config/bash/module/archive.sh +++ b/.config/bash/module/archive.sh @@ -7,10 +7,10 @@ _ARCHIVE_DATE() { # usage: archive [FILES] archive() { local IFS=$'\n' - local targets=("${@}") # target file(s). - local count=0 # processed count. - local total=${#} # total to process. - local date=$(_ARCHIVE_DATE) # date stamp. + local targets=("${@}") + local count=0 + local total=${#} + local date=$(_ARCHIVE_DATE) local failed=0 # Set dafult value to target all directories. @@ -34,7 +34,7 @@ archive() { tar -c "${target}" | pv -s $(du -sb "${target}" | awk '{print $1}') | xz -9e > "${name}".txz # append hash to target name. - mv "${name}".txz "${name}"_${date}-$(pv "${name}".txz | sha1sum | cut -d\ -f1).txz + mv "${name}".txz "${name}"_${date}-$(pv "${name}".txz | sha1sum | cut -d\ -f1).txz # Show error. if [[ ${?} != 0 ]]; then @@ -54,10 +54,10 @@ archive() { # usage: archive_fast [FILES] archive_fast() { local IFS=$'\n' - local targets=("${@}") # target file(s). - local count=0 # processed count. - local total=${#} # total to process. - local date=$(_ARCHIVE_DATE) # date stamp. + local targets=("${@}") + local count=0 + local total=${#} + local date=$(_ARCHIVE_DATE) local failed=0 # Set dafult value to target all directories. @@ -81,7 +81,7 @@ archive_fast() { tar -c "${target}" | pv -s $(du -sb "${target}" | awk '{print $1}') | gzip -1 > "${name}".tgz # append hash to target name. - mv "${name}".tgz "${name}"_${date}-$(pv "${name}".tgz | sha1sum | cut -d\ -f1).tgz + mv "${name}".tgz "${name}"_${date}-$(pv "${name}".tgz | sha1sum | cut -d\ -f1).tgz # Show error. if [[ $? != 0 ]]; then @@ -101,9 +101,9 @@ archive_fast() { # usage: archive_check [FILES] archive_check() { local IFS=$'\n' - local targets=("${@}") # target file(s). - local total=${#} # total to process. - local count=0 # processed count. + local targets=("${@}") + local total=${#} + local count=0 local failed=0 # set dafult value to target all supported archives. @@ -126,7 +126,7 @@ archive_check() { local saved=${data[2]} # calculate actual hash. - local actual=$(pv "${target}" | sha1sum | cut -d\ -f1) + local actual=$(pv "${target}" | sha1sum | cut -d\ -f1) # compare hashes, show error on mismatch. if [[ "${actual}" != "${saved}" ]]; then @@ -196,9 +196,9 @@ archive_prune() { # usage: unarchive [FILES] unarchive() { local IFS=$'\n' - local targets=("${@}") # target file(s). - local count=0 # processed count. - local total=${#} # total to process. + local targets=("${@}") + local count=0 + local total=${#} local failed=0 # set dafult value to target all supported archives. @@ -221,7 +221,7 @@ unarchive() { local saved="${data[2]}" # calculate actual hash. - local actual=$(pv "${target}" | sha1sum | cut -d\ -f1) + local actual=$(pv "${target}" | sha1sum | cut -d\ -f1) # extract if hash matched or show error if not. if [[ "${saved}" = "${actual}" ]]; then @@ -262,10 +262,10 @@ unarchive() { # usage: archive_name [ARCHIVE] [NAME] archive_name() { local IFS=$'\n' - local targets="${1}" # target archive(s). - local name="${2}" # new name. - local total=1 # total targets to process. - local count=0 # processed targets counter. + local targets="${1}" + local name="${2}" + local total=1 + local count=0 local failed=0 # set dafult value to target all supported archives.