Browse Source

tabs

pull/1477/head
Daniel Gibbs 8 years ago
parent
commit
26e5d14f24
  1. 48
      lgsm/functions/command_fastdl.sh
  2. 2
      lgsm/functions/core_functions.sh

48
lgsm/functions/command_fastdl.sh

@ -115,32 +115,32 @@ fn_fastdl_dirs(){
# Using this gist https://gist.github.com/agunnerson-ibm/efca449565a3e7356906
fn_human_readable_file_size(){
local abbrevs=(
$((1 << 60)):ZB
$((1 << 50)):EB
$((1 << 40)):TB
$((1 << 30)):GB
$((1 << 20)):MB
$((1 << 10)):KB
$((1)):bytes
)
local abbrevs=(
$((1 << 60)):ZB
$((1 << 50)):EB
$((1 << 40)):TB
$((1 << 30)):GB
$((1 << 20)):MB
$((1 << 10)):KB
$((1)):bytes
)
local bytes="${1}"
local precision="${2}"
local bytes="${1}"
local precision="${2}"
if [[ "${bytes}" == "1" ]]; then
echo "1 byte"
else
for item in "${abbrevs[@]}"; do
local factor="${item%:*}"
local abbrev="${item#*:}"
if [[ "${bytes}" -ge "${factor}" ]]; then
local size="$(bc -l <<< "${bytes} / ${factor}")"
printf "%.*f %s\n" "${precision}" "${size}" "${abbrev}"
break
fi
done
fi
if [[ "${bytes}" == "1" ]]; then
echo "1 byte"
else
for item in "${abbrevs[@]}"; do
local factor="${item%:*}"
local abbrev="${item#*:}"
if [[ "${bytes}" -ge "${factor}" ]]; then
local size="$(bc -l <<< "${bytes} / ${factor}")"
printf "%.*f %s\n" "${precision}" "${size}" "${abbrev}"
break
fi
done
fi
}
# Provides info about the fastdl directory content and prompts for confirmation

2
lgsm/functions/core_functions.sh

@ -543,7 +543,7 @@ fn_fetch_function
# Creates tmp dir if missing
if [ ! -d "${tmpdir}" ]; then
mkdir -p "${tmpdir}"
mkdir -p "${tmpdir}"
fi
# Calls on-screen messages (bootstrap)

Loading…
Cancel
Save