Created
June 2, 2014 01:23
-
-
Save vasi/91aa91634c6eb45c0963 to your computer and use it in GitHub Desktop.
Create a tarball, using a progress bar
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
# First arg is always option | |
arg1="$1" | |
shift | |
# Find first non-option | |
for i in "$@"; do | |
if [[ -z "$dir" && "$i" != -* ]]; then | |
dir="$i" | |
fi | |
done | |
size=$(du -sk "$dir" | cut -f1) | |
tar "$arg1" "$@" | pv -barpets "${size}k" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment