Created
November 6, 2014 01:34
-
-
Save amosshapira/0becb2d9bbd39dc7bf09 to your computer and use it in GitHub Desktop.
Read file names from stdin, verify that they are regular files. The nice thing about this is the in-place progress spinner
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
#!/bin/bash | |
spin='-\|/' | |
i=0 | |
ceol=`tput el` | |
while read filename | |
do | |
if [[ -f $filename ]] | |
then | |
i=$(( (i+1) % 4 )) | |
printf "\r${spin:$i:1} ${filename}${ceol}" | |
else | |
printf"\n${filename}\n" | |
fi | |
done | |
echo | |
exit 0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment