Skip to content

Instantly share code, notes, and snippets.

@Rican7
Created October 16, 2015 18:50
Show Gist options
  • Save Rican7/b725a2cdd7a54f780264 to your computer and use it in GitHub Desktop.
Save Rican7/b725a2cdd7a54f780264 to your computer and use it in GitHub Desktop.
Bash process. Pls.
#!/usr/bin/env bash
readonly PROGRESS_BAR_WIDTH=25
readonly PROGRESS_BAR_STEP_CHAR='#'
echo "Processing..."
for i in $(seq ${PROGRESS_BAR_WIDTH}); do
steps=$(printf "${PROGRESS_BAR_STEP_CHAR}%.0s" $(seq $i))
formatted=$(printf "%-${PROGRESS_BAR_WIDTH}s" ${steps})
percent=$(((100*${i})/${PROGRESS_BAR_WIDTH}))
echo -ne "|${formatted}| (${percent}%)\r"
sleep 0.1
done;
echo -ne '\n'
touch nev.rar
echo "Result: $(ls nev.rar)"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment