Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
#/bin/bash
set -euo pipefail
filepath=$1
# 10MBytes/sec
filesize=$(du -m ${filepath} | awk '{print $1}')
sleep_time=0.1
for num in $(seq 1 ${filesize});
do
truncate -s $((${filesize}-${num}))M ${filepath}
sleep ${sleep_time}
done
\rm ${filepath}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment