mirror of
https://github.com/fleschutz/PowerShell.git
synced 2024-12-27 09:08:58 +01:00
20 lines
450 B
PowerShell
20 lines
450 B
PowerShell
|
#!/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
|
||
|
}
|