Added simulate-typewriter.ps1

This commit is contained in:
Markus Fleschutz
2020-12-14 07:57:01 +00:00
parent 754a5c1899
commit 00085eb531
2 changed files with 23 additions and 0 deletions

22
Scripts/simulate-typewriter.ps1 Executable file
View File

@ -0,0 +1,22 @@
#!/snap/bin/powershell
# Syntax: ./simulate-typewriter.ps1 [<message>]
# Description: prints the given message with the typewriter effect
# Author: Markus Fleschutz
# Source: github.com/fleschutz/PowerShell
# License: CC0
param([string]$message)
if ($message -eq "" ) {
$message = "`nHello World`n-----------`nPowerShell is cross-platform`nPowerShell is open-source`nPowerShell is easy to learn`nPowerShell is fully documented`n`nThanks for watching`n`n:-)`n`n"
}
$Random = New-Object System.Random
$message -split '' |
ForEach-Object {
Write-Host $_ -nonew
Start-Sleep -milliseconds $(1 + $Random.Next(250))
}
exit 0