Never used Powershell before and im trying to recreate the following Bash script in powershell:
while true; do head -c200 /dev/urandom | od -An -w50 -x | grep -E --color "([[:alpha:]][[:digit:]]){2}"; sleep 0.5; done
Here's what i got, but i want it to turn random lines into red, rather than every five instances;
while(Get-Random)
{
Start-Sleep -Milliseconds 10
Write-Host -NoNewline " " (get-random)
Start-Sleep -Milliseconds 30
Write-Host -NoNewline " " (get-random)
Start-Sleep -Milliseconds 10
Write-Host -NoNewline " " (get-random)
Start-Sleep -Milliseconds 30
Write-Host -NoNewline " " (get-random)
Start-Sleep -Milliseconds 10
Write-Host -NoNewline " " (get-random) -ForegroundColor red
}
Any idea how i can go about setting "-ForegroundColor red" for random lines?
Aucun commentaire:
Enregistrer un commentaire