Created
June 1, 2020 19:20
-
-
Save ShooShoSha/24669c3ac571096f75abd761a0481bd9 to your computer and use it in GitHub Desktop.
Shell script gets random mnemonic word
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/sh | |
# Gets a random mnemonic word from a gist. | |
# See https://gist.github.com/bwbaugh/bf78612ef58ad0402a05 | |
URL='https://gist.githubusercontent.com/bwbaugh/bf78612ef58ad0402a05/raw/0f8ea7a054ff5c9c4209414beadf7a3acdd03373/server-name-wordlist-mnemonic.txt' | |
NAME=`curl --silent --show-error "$URL" | tail --lines +4 | shuf | head --lines 1` | |
echo "$NAME" | |
return 0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
In PowerShell, suppose the variable
$URL
is the same asURL
above, then$Name
should be equivalent toName
as:$Name = Get-Random ((Invoke-WebRequest -URI $URL).Content.ReplaceLineEndings().Split([Environment]::NewLine) | Select -Skip 4)