Unverified Commit dd3b0b9d authored by Kroese's avatar Kroese Committed by GitHub
Browse files

Update progress.sh

parent 73610b85
Loading
Loading
Loading
Loading
+6 −4
Original line number Diff line number Diff line
#!/usr/bin/env bash
set -Eeuo pipefail

info="/run/shm/msg.html"

escape () {
    local s
    s=${1//&/\&}
@@ -13,18 +15,18 @@ escape () {

file="$1"
total="$2"
bytes="0"
body=$(escape "$3")
info="/run/shm/msg.html"

if [[ "$body" == *"..." ]]; then
  body="<p class=\"loading\">${body/.../}</p>"
  body="<p class=\"loading\">${body::-3}</p>"
fi

while true
do

  if [ -s "$file" ] || [ -d "$file" ]; then
  if [ ! -s "$file" ] && [ ! -d "$file" ]; then
    bytes="0"
  else
    bytes=$(du -sb "$file" | cut -f1)
  fi