seems to work - i modified it a bit, that you can also use it with .tar.gz files:
#!/bin/bash
file_name="your-tar-gz-nam
file_size=`gunzip -l $file_name | awk '{ print $2 }' | grep -v uncompressed`
# Getting the exact file size in bytes
filekb=`echo "$file_size/1024" | bc`
# converting that into kilobytes
ini_fs_size=`df -k . | awk '{ print $3 }' | grep -v Used`
# getting the current filesystem size where your extracting
# the file .
percentage=0
final_percent=100
tar -xzf $file_name &
{
while [ "$percentage" -lt $final_percent ]
do
latter_fs_size=`df -k . | awk '{ print $3 }' | grep -v Used`
# After extracting started get the filesystem size every second
# and the do a small math
percent_val=`expr $latter_fs_size - $ini_fs_size`
# Get the difference between intial and current filestem space
percentage=`echo "($percent_val * 100)/$filekb" | bc`
# get the precentage of it with respect to original file size
if [ "$percentage" -gt $final_percent ]
then
echo $final_percent
else
echo $percentage
fi
# the above if loop si to cover up just in case
sleep 1
done
} | dialog --gauge "Uncompressing status" 6 70 0
clear
Main Topics
Browse All Topics





by: AndyWHVPosted on 2005-03-03 at 07:38:37ID: 13450340
dialog --guage "Uncompressing status" 6 70 0
has to be dialog --gauge
that is what i can see immediately .... if theres more - let me know