mirror of
https://github.com/fleschutz/PowerShell.git
synced 2025-02-23 05:01:37 +01:00
Added next-joke.ps1
This commit is contained in:
parent
67aa4372a6
commit
85811b5d70
@ -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
|
||||
|
|
@ -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
17
Scripts/next-joke.ps1
Executable 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
|
||||
}
|
Loading…
Reference in New Issue
Block a user