Created
June 15, 2015 18:05
-
-
Save yudi-matsuzake/242b4166d9e07e8c356e to your computer and use it in GitHub Desktop.
./fu.sh arquivo frase 1000
This file contains 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 | |
if [ "$#" -ne 3 ] | |
then | |
exit | |
fi | |
echo "arquivo: $1" | |
echo "tamanho: $3" | |
echo "frase: \"$2\"" | |
> "$1" | |
tam="`du $1 | awk '{ print $1 }'`" | |
yes "$2" > "$1" & | |
pid_yes=$! | |
while [ "$tam" -lt "$3" ] | |
do | |
tam="`du $1 | awk '{ print $1 }'`" | |
echo -en "$tam/$3\r" | |
done | |
kill "$pid_yes" | |
echo |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment