diff --git a/README.md b/README.md index e5e519ea..5f5b1368 100644 --- a/README.md +++ b/README.md @@ -58,6 +58,9 @@ The following PowerShell scripts can be found in the [Scripts/](Scripts/) subfol * [weather-report.ps1](Scripts/weather-report.ps1) - prints the local weather report * [weather-worldwide.ps1](Scripts/weather-worldwide.ps1) - prints the current weather of cities worldwide * [wakeup.ps1](Scripts/wakeup.ps1) - sends a magic packet to the given computer, waking him up +* [write-blue.ps1](Scripts/write-blue.ps1) - writes the given text in blue +* [write-green.ps1](Scripts/write-green.ps1) - writes the given text in green +* [write-red.ps1](Scripts/write-red.ps1) - writes the given text in red * [zip-dir.ps1](Scripts/zip-dir.ps1) - creates a zip archive of the given folder diff --git a/Scripts/set-timer.ps1 b/Scripts/set-timer.ps1 index c96151e0..b6b67544 100755 --- a/Scripts/set-timer.ps1 +++ b/Scripts/set-timer.ps1 @@ -7,11 +7,10 @@ # License: CC0 param([int]$Seconds) -if ($Seconds -eq 0 ) { - [int]$Seconds = read-host "Enter number of seconds" -} - try { + if ($Seconds -eq 0 ) { + [int]$Seconds = read-host "Enter number of seconds" + } for ($i = $Seconds; $i -gt 0; $i--) { write-progress "$i seconds" start-sleep -s 1 diff --git a/Scripts/write-blue.ps1 b/Scripts/write-blue.ps1 new file mode 100755 index 00000000..0c7d1a03 --- /dev/null +++ b/Scripts/write-blue.ps1 @@ -0,0 +1,19 @@ +#!/snap/bin/powershell + +# Syntax: ./write-blue.ps1 [<text>] +# Description: writes the given text in blue +# Author: Markus Fleschutz +# Source: github.com/fleschutz/PowerShell +# License: CC0 + +param([String]$Text) +try { + if ($Text -eq "" ) { + [String]$Text = read-host "Enter text to write" + } + write-host -foregroundcolor blue $Text + exit 0 +} catch { + write-error "ERROR in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])" + exit 1 +} diff --git a/Scripts/write-green.ps1 b/Scripts/write-green.ps1 new file mode 100755 index 00000000..25725780 --- /dev/null +++ b/Scripts/write-green.ps1 @@ -0,0 +1,19 @@ +#!/snap/bin/powershell + +# Syntax: ./write-green.ps1 [<text>] +# Description: writes the given text in green +# Author: Markus Fleschutz +# Source: github.com/fleschutz/PowerShell +# License: CC0 + +param([String]$Text) +try { + if ($Text -eq "" ) { + [String]$Text = read-host "Enter text to write" + } + write-host -foregroundcolor green $Text + exit 0 +} catch { + write-error "ERROR in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])" + exit 1 +} diff --git a/Scripts/write-red.ps1 b/Scripts/write-red.ps1 new file mode 100755 index 00000000..95216478 --- /dev/null +++ b/Scripts/write-red.ps1 @@ -0,0 +1,19 @@ +#!/snap/bin/powershell + +# Syntax: ./write-red.ps1 [<text>] +# Description: writes the given text in red +# Author: Markus Fleschutz +# Source: github.com/fleschutz/PowerShell +# License: CC0 + +param([String]$Text) +try { + if ($Text -eq "" ) { + [String]$Text = read-host "Enter text to write" + } + write-host -foregroundcolor red $Text + exit 0 +} catch { + write-error "ERROR in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])" + exit 1 +}