Skip to content

Commit

Permalink
Update progress.sh
Browse files Browse the repository at this point in the history
  • Loading branch information
kroese authored Jan 29, 2024
1 parent 3e06c33 commit 25cf395
Showing 1 changed file with 0 additions and 30 deletions.
30 changes: 0 additions & 30 deletions src/progress.sh
Original file line number Diff line number Diff line change
Expand Up @@ -19,36 +19,6 @@ if [[ "$body" == *"..." ]]; then
body="<p class=\"loading\">${body/.../}</p>"
fi

while true
do
if [ -f "$file" ]; then
bytes=$(du -sb "$file" | cut -f1)
if (( bytes > 1000 )); then
size=$(echo "$bytes" | numfmt --to=iec --suffix=B | sed -r 's/([A-Z])/ \1/')
echo "${body//(\[P\])/($size)}"> "$info"
fi
fi
#!/usr/bin/env bash
set -Eeuo pipefail

escape () {
local s
s=${1//&/\&amp;}
s=${s//</\&lt;}
s=${s//>/\&gt;}
s=${s//'"'/\&quot;}
printf -- %s "$s"
return 0
}

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

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

while true
do
if [ -f "$file" ]; then
Expand Down

0 comments on commit 25cf395

Please sign in to comment.