-
Execute code if a script directly called
I often want to run some arbitrary code if I run a script directly. The primary example that comes to mind these days is: Strangely enough, despite primarily using Ruby on a daily basis, I haven’t really thought about how this test looks in Ruby: Bash seemed a little more obvious, but apparently there’s a…
-
bash/zsh vs. PowerShell find files
Trying to make the basic Unix find pattern happen in PowerShell.
-
Searching for a String in Environmental Variables in Powershell
I’ve updated the post through feedback in the comments: Regex compare on strings for Get-Variable is Where-Object -Match. So, the closest parallel to the following bash code: set | grep “Users” is the following Powershell: Get-Variable | Where-Object { $_.Value -Match “Users” } or shortened: gv | ? {$_.Value -Match “Users”} Original Post, with Updates…