Last active
June 8, 2016 04:06
-
-
Save selbyk/b34803d6d20d0980a63070aa77e87a58 to your computer and use it in GitHub Desktop.
Generate random hex
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
#!/bin/bash | |
length=12 | |
if [[ $1 =~ ^[0-9]+$ ]]; then | |
length=$1 | |
fi | |
cat /dev/urandom | tr -dc 'a-fA-F0-9' | fold -w $length | head -n 1 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment