Last active
December 3, 2018 07:44
-
-
Save dantheman213/418d6b8d65158b19da2e99aff50d4ea4 to your computer and use it in GitHub Desktop.
Bash Shell Script Cross-platform Generate Random String Easily With Pre-Installed System Tools
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 | |
| # Bash Shell Script Cross-platform Generate Random String Easily With Pre-Installed System Tools | |
| MD5_BIN="md5sum" # default for windows git bash and linux | |
| COMMAND_OUTPUT=$(command -v md5sum) | |
| if [ ${#COMMAND_OUTPUT} -lt 1 ]; then | |
| MD5_BIN="md5" # OSX | |
| fi | |
| echo $(date | ${MD5_BIN} | tr -dc '[:alnum:]\n\r' | tr '[:upper:]' '[:lower:]') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment