Skip to content

Instantly share code, notes, and snippets.

@ShadSterling
Created July 3, 2024 17:49
Show Gist options
  • Select an option

  • Save ShadSterling/95ca749b625916529af12af9537a8ee2 to your computer and use it in GitHub Desktop.

Select an option

Save ShadSterling/95ca749b625916529af12af9537a8ee2 to your computer and use it in GitHub Desktop.

Revisions

  1. ShadSterling created this gist Jul 3, 2024.
    10 changes: 10 additions & 0 deletions random-string
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,10 @@
    #!/usr/bin/env bash

    # from https://gist.github.com/earthgecko/3089509#gistcomment-1219444

    count=$1
    if [ "" == "$count" ]; then
    count=64
    fi

    LC_CTYPE=C tr -dc A-Za-z0-9 < /dev/urandom | fold -w ${1:-$count} | head -n +1