mirror of
https://github.com/fleschutz/PowerShell.git
synced 2025-06-30 20:50:02 +02:00
Added write-red.ps1, write-green.ps1 and write-blue.ps1
This commit is contained in:
@ -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
|
||||
|
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
|
||||
}
|
Reference in New Issue
Block a user