Added next-joke.ps1

This commit is contained in:
Markus Fleschutz 2021-01-12 17:06:35 +01:00
parent 67aa4372a6
commit 85811b5d70
3 changed files with 19 additions and 0 deletions

View File

@ -50,6 +50,7 @@ MD5.ps1, prints the MD5 checksum of the given file
make-install.ps1, installs built executables and libs to the installation directory
moon.ps1, prints the current moon phase
mute-audio.ps1, mutes audio
next-joke.ps1], gets the next random Juck Norris joke
open-browser.ps1, starts the default Web browser
open-calculator.ps1, starts the calculator program
open-email-client.ps1, starts the default email client

1 Filename Description
50 make-install.ps1 installs built executables and libs to the installation directory
51 moon.ps1 prints the current moon phase
52 mute-audio.ps1 mutes audio
53 next-joke.ps1] gets the next random Juck Norris joke
54 open-browser.ps1 starts the default Web browser
55 open-calculator.ps1 starts the calculator program
56 open-email-client.ps1 starts the default email client

View File

@ -64,6 +64,7 @@ The following PowerShell scripts can be found in the [Scripts/](Scripts/) subfol
* [play-beep.ps1](Scripts/play-beep.ps1) - plays a beep sound
* [poweroff.ps1](Scripts/poweroff.ps1) - halts the local computer (needs administrator rights)
* [new-email.ps1](Scripts/new-email.ps1) - starts the default email client to write a new email
* [next-joke.ps1](Scripts/next-joke.ps1) - gets the next random Juck Norris joke
* [reboot.ps1](Scripts/reboot.ps1) - reboots the local computer (needs administrator rights)
* [reboot-fritzbox.ps1](Scripts/reboot-fritzbox.ps1) - reboots the FRITZ!box device
* [search-files.ps1](Scripts/search-files.ps1) - searches the given pattern in the given files

17
Scripts/next-joke.ps1 Executable file
View File

@ -0,0 +1,17 @@
#!/snap/bin/powershell
<#
.SYNTAX ./next-joke.ps1
.DESCRIPTION gets the next random Juck Norris joke
.LINK https://github.com/fleschutz/PowerShell
.NOTES Author: Markus Fleschutz / License: CC0
#>
try {
$Response = (invoke-webRequest http://api.icndb.com/jokes/random).Content | ConvertFrom-Json
$Joke = $Response.value.joke
write-output "$Text"
exit 0
} catch {
write-error "ERROR in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
exit 1
}