Skip to content

Instantly share code, notes, and snippets.

@obstschale
Last active December 17, 2015 05:59
Show Gist options
  • Save obstschale/5562217 to your computer and use it in GitHub Desktop.
Save obstschale/5562217 to your computer and use it in GitHub Desktop.
small script to generate some dummy files and commit them. (by @matthewmccullough | src: https://github.com/matthewmccullough/scripts/blob/master/generaterandomchanges)
#!/bin/bash
#Ensure we have the quantity specified on the CLI
if [ -z "$3" ]; then ARG_ERR=ERR; fi
if [ -z "$2" ]; then ARG_ERR=ERR; fi
if [ -z "$1" ]; then ARG_ERR=ERR; fi
if [ -n "$ARG_ERR" ];
then
echo "Usage: <filecount> <filenamebase> <filenameextension>"
exit
fi
count=$1
filenamebase=$2
filenameextension=$3
for (( filenumber = 1; filenumber <= $count ; filenumber++ )); do
echo "Some new random text: $RANDOM" >> $filenamebase$filenumber.$filenameextension
git add $filenamebase$filenumber.$filenameextension
git commit -m"A random change of $RANDOM to $filenamebase$filenumber.$filenameextension"
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment