Skip to content

Instantly share code, notes, and snippets.

@dantheman213
Last active December 3, 2018 07:44
Show Gist options
  • Select an option

  • Save dantheman213/418d6b8d65158b19da2e99aff50d4ea4 to your computer and use it in GitHub Desktop.

Select an option

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
#!/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