-
Notifications
You must be signed in to change notification settings - Fork 134
/
my_ps_functions.ps1
executable file
·26 lines (22 loc) · 1.01 KB
/
my_ps_functions.ps1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# my_ps_functions.ps1 within https://github.com/wilsonmar/git-utilities
# PowerShell functions custom library to workaround dificiencies.
# for running under PowerShell on Mac or Windows
# by [email protected] @wilsonmar
# Here are various custom functions
# Sample invocation code:
# & ((Split-Path $MyInvocation.InvocationName) + "\my_ps_functions.ps1")
# From orad in http://stackoverflow.com/questions/31888580/a-better-way-to-check-if-a-path-exists-or-not-in-powershell
# https://connect.microsoft.com/PowerShell/feedbackdetail/view/1643846/
# Add aliases that should be made available in PowerShell by default:
function not-exist { -not (Test-Path $args) }
Set-Alias !exist not-exist -Option "Constant, AllScope"
Set-Alias exist Test-Path -Option "Constant, AllScope"
# Use this in conditional statements such as:
# if (exist $path) { ... }
# and
# if (not-exist $path)) { ... }
# if (!exist $path)) { ... }
function Get-MacOsXsysteminformation {
[xml]$infos = system_profiler -xml
return $infos
}