Skip to content

Instantly share code, notes, and snippets.

@niteria
Created May 10, 2011 21:21
Show Gist options
  • Save niteria/965404 to your computer and use it in GitHub Desktop.
Save niteria/965404 to your computer and use it in GitHub Desktop.
make nice progress bar for batch script
#!/bin/bash
echo 50
for i in `seq 1 10`; do echo '1'; sleep 1; done
#!/bin/bash
pipename=`uuidgen`
mkfifo "$pipename"
trap "rm -f -- '$pipename'" EXIT
./cmd.sh > "$pipename" &
num=$(head -n 1 "$pipename")
cat "$pipename" | pv -s $num -p -l -e -t -b > /dev/null
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment