Created
October 16, 2015 18:50
-
-
Save Rican7/b725a2cdd7a54f780264 to your computer and use it in GitHub Desktop.
Bash process. Pls.
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
#!/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