Rename to write-quote.ps1 and speak-quote.ps1

This commit is contained in:
Markus Fleschutz
2021-08-08 11:02:12 +02:00
parent b1b52dc03a
commit af119fc7db
9 changed files with 66 additions and 112 deletions

29
Scripts/write-quote.ps1 Executable file
View File

@ -0,0 +1,29 @@
<#
.SYNOPSIS
write-quote.ps1
.DESCRIPTION
Writes a random quote to the console.
.EXAMPLE
PS> .\write-quote.ps1
.LINK
https://github.com/fleschutz/PowerShell
.NOTES
Author: Markus Fleschutz
License: CC0
#>
try {
$Table = import-csv "$PSScriptRoot/../Data/quotes.csv"
$NumRows = $Table.count
$Generator = New-Object System.Random
$Index = [int]$Generator.next(0,$NumRows - 1)
$Quote = $Table[$Index].Quote
$Author = $Table[$Index].Author
"📣 $Quote <$Author>"
exit 0
} catch {
write-error "⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
exit 1
}