Skip to content

Instantly share code, notes, and snippets.

@amosshapira
Created November 6, 2014 01:34
Show Gist options
  • Save amosshapira/0becb2d9bbd39dc7bf09 to your computer and use it in GitHub Desktop.
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
#!/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