diff --git a/profile.ps1 b/profile.ps1 index 5349b23..8d0d4a2 100644 --- a/profile.ps1 +++ b/profile.ps1 @@ -91,6 +91,22 @@ function fsh { Enter-PSSession @PSBoundParameters @args } +function watch { + param ( + [int]$n = 2, + + [Parameter(Mandatory, + Position = 0)] + $ScriptBlock + ) + + while ($true) { + $o = Invoke-Command -ScriptBlock $ScriptBlock + Clear-Host + $o + Start-Sleep -Seconds $n + } +} #check for old version if($PSVersionTable.PSVersion.Major -le 5){