Created
June 2, 2023 12:33
-
-
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
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 | |
| _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