From 4b01e23084303181c669ec032eea7ef2a0cef932 Mon Sep 17 00:00:00 2001 From: Markus Fleschutz Date: Sat, 5 Aug 2023 10:23:20 +0200 Subject: [PATCH] Update check-swap-space.ps1 and new-script.ps1 --- Scripts/check-swap-space.ps1 | 3 ++- Scripts/new-script.ps1 | 4 ++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/Scripts/check-swap-space.ps1 b/Scripts/check-swap-space.ps1 index fd5d3ee6..6b350fd3 100755 --- a/Scripts/check-swap-space.ps1 +++ b/Scripts/check-swap-space.ps1 @@ -52,7 +52,8 @@ try { } elseif ($Used -eq 0) { Write-Output "✅ Swap space with $(MB2String $Total) reserved" } elseif ($Used -lt $Free) { - Write-Output "✅ Swap space uses $(MB2String $Used) of $(MB2String $Total)" + [int]$Percent = ($Used * 100) / $Total + Write-Output "✅ Swap space uses $(MB2String $Used) or $($Percent)% of $(MB2String $Total)" } else { Write-Output "✅ Swap space has $(MB2String $Free) of $(MB2String $Total) free" } diff --git a/Scripts/new-script.ps1 b/Scripts/new-script.ps1 index bca4c92f..9e8199f5 100755 --- a/Scripts/new-script.ps1 +++ b/Scripts/new-script.ps1 @@ -17,9 +17,9 @@ param([string]$filename = "") try { - if ($filename -eq "" ) { $shortcut = read-host "Enter the new filename" } + if ($filename -eq "" ) { $filename = Read-Host "Enter the new filename" } - copy-item "$PSScriptRoot/../Data/template.ps1" "$filename" + Copy-Item "$PSScriptRoot/../Data/template.ps1" "$filename" "✔️ created new PowerShell script: $filename" exit 0 # success