mirror of
https://github.com/fleschutz/PowerShell.git
synced 2025-04-06 23:42:10 +02:00
Added write-red.ps1, write-green.ps1 and write-blue.ps1
This commit is contained in:
parent
34a7d8b3be
commit
d93469c392
@ -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-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
|
* [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
|
* [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
|
* [zip-dir.ps1](Scripts/zip-dir.ps1) - creates a zip archive of the given folder
|
||||||
|
|
||||||
|
|
||||||
|
@ -7,11 +7,10 @@
|
|||||||
# License: CC0
|
# License: CC0
|
||||||
|
|
||||||
param([int]$Seconds)
|
param([int]$Seconds)
|
||||||
if ($Seconds -eq 0 ) {
|
|
||||||
[int]$Seconds = read-host "Enter number of seconds"
|
|
||||||
}
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
if ($Seconds -eq 0 ) {
|
||||||
|
[int]$Seconds = read-host "Enter number of seconds"
|
||||||
|
}
|
||||||
for ($i = $Seconds; $i -gt 0; $i--) {
|
for ($i = $Seconds; $i -gt 0; $i--) {
|
||||||
write-progress "$i seconds"
|
write-progress "$i seconds"
|
||||||
start-sleep -s 1
|
start-sleep -s 1
|
||||||
|
19
Scripts/write-blue.ps1
Executable file
19
Scripts/write-blue.ps1
Executable file
@ -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
|
||||||
|
}
|
19
Scripts/write-green.ps1
Executable file
19
Scripts/write-green.ps1
Executable file
@ -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
|
||||||
|
}
|
19
Scripts/write-red.ps1
Executable file
19
Scripts/write-red.ps1
Executable file
@ -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
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user