Skip to content

Instantly share code, notes, and snippets.

@stknohg
Last active April 11, 2018 03:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save stknohg/9f82ddbc2e3e4c43a1b12f99d5b53f50 to your computer and use it in GitHub Desktop.
Save stknohg/9f82ddbc2e3e4c43a1b12f99d5b53f50 to your computer and use it in GitHub Desktop.
YumとAptでインストール可能なPowerShell Coreのバージョン一覧
yum list available --showduplicates -q powershell `
| Select-Object -Skip 1 `
| ForEach-Object {
$packageName = (-split $_)[1]
if ($packageName -match "^(?<Major>\d+)\.(?<Minor>\d+)\.(?<Patch>\d+)(-.+$|\~(?<Label>.+)-.+$)") {
$version = [SemVer]::new($Matches.Major, $Matches.Minor, $Matches.Patch, $Matches.Label)
}
[PSCustomObject]@{ Version = $version; PackageName = "powershell-{0}" -f $packageName}
} `
| Format-Table -AutoSize
# apt
apt-cache madison powershell `
| ForEach-Object {
$packageName = ($_ -split '\|')[1].Trim()
if ($packageName -match "^(?<Major>\d+)\.(?<Minor>\d+)\.(?<Patch>\d+)(-.+$|\~(?<Label>.+)-.+$)") {
$version = [SemVer]::new($Matches.Major, $Matches.Minor, $Matches.Patch, $Matches.Label)
}
[PSCustomObject]@{ Version = $version; PackageName = "powershell-{0}" -f $packageName}
} `
| Format-Table -AutoSize
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment