Skip to content

Instantly share code, notes, and snippets.

@TheFlash2k
Created June 2, 2023 12:33
Show Gist options
  • Select an option

  • Save TheFlash2k/84f192ecadc6716d5a5e99ba5ac6c952 to your computer and use it in GitHub Desktop.

Select an option

Save TheFlash2k/84f192ecadc6716d5a5e99ba5ac6c952 to your computer and use it in GitHub Desktop.
Generates a random string where length of the string is passed as an argument
#!/bin/bash
_len=10
if [[ $# == 1 ]]; then
_len=$1
fi
tr -dc A-Za-z0-9 </dev/urandom | head -c $_len ; echo ''
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment