Sorry, but this isn't possible. From the file
'bar' works just like 'cat', but shows a progress bar in ASCII art on stderr.
The script's main function is meant to be usable in any Bourne shell to be
suitable for install scripts without the need for any additional tool.
The problem is that, in order to display the progress bar,
bar has to know the file's size first.
For extracting an archieve, that's no problem: If
100 MiB big and
50 MiB have been processed so far, we're at
However, for creating an archieve,
bar reads from
stdin, which is infinite for all practical purposes. As the documentation says:
Infinite streams are not nice: the bar is only displayed at 0% and at 100%. [...]
The only way to display progress bars for backup purposes I can think of (besides compiling a custom version of tar with bar) is:
Calculate the accumulated size of the files
backup.tar and append the files from
/media/data one by one.
After each file, calculate the current percentage and display it.
backup.tar (you can use
tar for this).
TOTAL=$(du -b /media/data | grep -oP "^\d+")
for FILE in $(find /media/data -type f); do
tar rf backup.tar $FILE
CURRENT=$(($CURRENT+$(du -b $FILE | grep -oP "^\d+")))
echo -en "\r"$((100*($CURRENT-1)/$TOTAL+1))"%"
bar backup.tar | gzip > backup.tar.gz
- This will probably slow down your backup progress.
- File names may not contain newline characters.