Skip to content

Instantly share code, notes, and snippets.

@markasoftware
Created May 6, 2019 21:23
Show Gist options
  • Save markasoftware/f0919b875362fd89e3e0c538943836da to your computer and use it in GitHub Desktop.
Save markasoftware/f0919b875362fd89e3e0c538943836da to your computer and use it in GitHub Desktop.
Generate a file with random contents, certain length, and fixed beginning and ending characters (phone number in file size).
#!/bin/sh
if [ "$#" != 4 ]
then
echo 'USAGE: number.sh ~/my-phone-number 12065555555 o o'
exit 1
fi
echo -n "$3" > "$1"
base32 < /dev/urandom | tr A-Z0-9\\n a-za-z | tr -d '=' | head -c $["$2"-2] >> "$1"
echo -n "$4" >> "$1"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment