diff --git a/.config/bash/module/Archive.sh b/.config/bash/module/Archive.sh index b55d6b4..71e1eaa 100644 --- a/.config/bash/module/Archive.sh +++ b/.config/bash/module/Archive.sh @@ -22,7 +22,7 @@ function archive() { [[ -f "${target}/.archiveignore" ]] && exclude="--exclude-from=${target}/.archiveignore" # create archive. - local hash=$(tar ${exclude} -c ${target} | pv -s $(du -sb ${target} | awk '{print $1}') | xz -9e | tee ${name}.txz | sha1sum | cut -d\ -f1) + local hash=$(tar ${exclude} -c ${target} | pv -s $(/usr/bin/env du -sb ${target} | awk '{print $1}') | xz -9e | tee ${name}.txz | sha1sum | cut -d\ -f1) # append hash to target name. local new_name="${name}_${date}-${hash}.txz" @@ -57,7 +57,7 @@ function archive_mt() { local mem_limit=$((mem_free*3/4)) # create archive. - local hash=$(tar ${exclude} -c ${target} | pv -s $(du -sb ${target} | awk '{print $1}') | xz -9e --threads=0 --memlimit=${mem_limit}MiB | tee ${name}.txz | sha1sum | cut -d\ -f1) + local hash=$(tar ${exclude} -c ${target} | pv -s $(/usr/bin/env du -sb ${target} | awk '{print $1}') | xz -9e --threads=0 --memlimit=${mem_limit}MiB | tee ${name}.txz | sha1sum | cut -d\ -f1) # append hash to target name. local new_name="${name}_${date}-${hash}.txz" @@ -89,7 +89,7 @@ function archive_fast() { [[ -f "${target}/.archiveignore" ]] && exclude="--exclude-from=${target}/.archiveignore" # create archive. - local hash=$(tar ${exclude} -c "${target}" | pv -s $(du -sb "${target}" | awk '{print $1}') | gzip -1 | tee "${name}".tgz | sha1sum | cut -d\ -f1) + local hash=$(tar ${exclude} -c "${target}" | pv -s $(/usr/bin/env du -sb "${target}" | awk '{print $1}') | gzip -1 | tee "${name}".tgz | sha1sum | cut -d\ -f1) # append hash to target name. local new_name="${name}_${date}-${hash}.tgz" diff --git a/.config/bash/module/Disk.sh b/.config/bash/module/Disk.sh index ae57262..3068b93 100644 --- a/.config/bash/module/Disk.sh +++ b/.config/bash/module/Disk.sh @@ -1,7 +1,11 @@ # Show only physical drives info. -alias df="df --si | sed -e '1p' -e '/^\/dev\//!d'" +function df() { + df --si | sed -e '1p' -e '/^\/dev\//!d' +} # Show combined size in SI. # Current dir by default. # Usage: du [DIRS] -alias du="du -sh --si" +function du() { + du -sh --si +} diff --git a/.config/bash/module/Pack.sh b/.config/bash/module/Pack.sh index 33c72ee..7c6ab7e 100644 --- a/.config/bash/module/Pack.sh +++ b/.config/bash/module/Pack.sh @@ -111,15 +111,15 @@ function _pack_zip() { } function _pack_tgz() { - tar -c "${@:2}" | pv -s $(du -csb "${@:2}" | sed -n -e '$p' | awk '{print $1}') | gzip -1 > "${1}" + tar -c "${@:2}" | pv -s $(/usr/bin/env du -csb "${@:2}" | sed -n -e '$p' | awk '{print $1}') | gzip -1 > "${1}" } function _pack_txz() { - tar -c "${@:2}" | pv -s $(du -csb "${@:2}" | sed -n -e '$p' | awk '{print $1}') | xz -9e > "${1}" + tar -c "${@:2}" | pv -s $(/usr/bin/env du -csb "${@:2}" | sed -n -e '$p' | awk '{print $1}') | xz -9e > "${1}" } function _pack_tar() { - tar -c "${@:2}" | pv -s $(du -csb "${@:2}" | sed -n -e '$p' | awk '{print $1}') > "${1}" + tar -c "${@:2}" | pv -s $(/usr/bin/env du -csb "${@:2}" | sed -n -e '$p' | awk '{print $1}') > "${1}" } function _pack_gz() {