Skip to content

Instantly share code, notes, and snippets.

@crater2150
Last active March 12, 2020 13:18
Show Gist options
  • Save crater2150/a7f685ef22d09100e5f55a188c90ba86 to your computer and use it in GitHub Desktop.
Save crater2150/a7f685ef22d09100e5f55a188c90ba86 to your computer and use it in GitHub Desktop.
zsh: run operations on files while showing progress
files=(*.foo)
for i in {1..$#files}; do
file=$files[$i]
pad=${#${#files}}
printf "\e[2K\e[G ‣ %${pad}d / %${pad}d: %s" $i $#files $file
{
# do stuff with file here
} &>/dev/null
done
echo
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment