Skip to content

Instantly share code, notes, and snippets.

@yudi-matsuzake
Created June 15, 2015 18:05
Show Gist options
  • Save yudi-matsuzake/242b4166d9e07e8c356e to your computer and use it in GitHub Desktop.
Save yudi-matsuzake/242b4166d9e07e8c356e to your computer and use it in GitHub Desktop.
./fu.sh arquivo frase 1000
#!/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