diff --git a/.linux/bash/module/archive.sh b/.linux/bash/module/archive.sh index 993b3aa..ad3270b 100644 --- a/.linux/bash/module/archive.sh +++ b/.linux/bash/module/archive.sh @@ -1,5 +1,8 @@ _ARCHIVE_PATTERN="_[0-9]{12}-[[:alnum:]]{40}.t[xg]z" -alias _ARCHIVE_DATE="date +%Y%m%d%H%M" +_ARCHIVE_DATE() +{ + date +%Y%m%d%H%M +} # archive file with maximum compression and checksum. # usage: archive [FILES] @@ -277,7 +280,8 @@ archive_convert() } # export everything, primarily for use with parallel.. -export -f archive archive_fast archive_check unarchive archive_name +export -f archive archive_fast archive_check unarchive archive_name _ARCHIVE_DATE +export _ARCHIVE_PATTERN # autocomplete. _archive_name() diff --git a/.linux/bash/module/pack.sh b/.linux/bash/module/pack.sh index e1d4764..927e57e 100644 --- a/.linux/bash/module/pack.sh +++ b/.linux/bash/module/pack.sh @@ -106,13 +106,13 @@ unpack() # actions on error. if [[ $? != 0 ]]; then - _error "${target}" + _pack_error "${target}" ((failed++)) fi done # print report. - if [[ ${count} -gt 1 ]]; then + if [[ ${count} -gt 1 ]] || [[ "${*}" = "" ]]; then if [[ ${failed} -gt 0 ]]; then echo -e "${color_bred}Items failed to unpack: ${failed}.${color_default}" else @@ -122,7 +122,7 @@ unpack() } # show error. -_error() +_pack_error() { echo -e "${color_bred}${1}: failed.${color_default}" } @@ -180,3 +180,6 @@ _unpack_tar() { pv "${1}" | tar -xf - } + +# export functions. +export -f pack unpack _pack_tgz _pack_txz _pack_tar _pack_zip _unpack_zip _unpack_7z _unpack_tgz _unpack_txz _unpack_tar _pack_error