Created
November 21, 2019 14:25
-
-
Save bgshacklett/bff4f2a8e6caa89d9239735fe344cf21 to your computer and use it in GitHub Desktop.
A PowerShell Script/Function which takes a Posix environment (output by env, for instance) and converts it to a PowerShell environment format.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
param | |
( | |
[Parameter(ValueFromPipeline="true")] | |
[String]$PosixVars | |
) | |
Process | |
{ | |
$PosixVars ` | |
| ForEach-Object { | |
$var = $_ ` | |
-replace 'export ', '' ` | |
-split '=' ` | |
('$env:{0} = "{1}"') -f $var[0], $var[1] | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment