added relative path instead of fullpath

This commit is contained in:
Darii Nurgaleev
2020-10-13 20:02:18 +07:00
parent 01e2f948f6
commit 6238508a21
+5 -4
View File
@@ -9,13 +9,14 @@ function Validate-Scripts {
) )
$ScriptWithoutShebangLine = @() $ScriptWithoutShebangLine = @()
Get-ChildItem $path -Recurse -File -Filter "*.sh" | ForEach-Object { Get-ChildItem $path -Recurse -File -Filter "*.sh" | ForEach-Object {
$shebangLine = Get-Content -Path $($_.FullName) | Select-Object -First 1 $RelativePath = Join-Path $Path $($_.Name)
$shebangLine = Get-Content -Path $RelativePath | Select-Object -First 1
if ($shebangLine -eq $ExpectedShebang) { if ($shebangLine -eq $ExpectedShebang) {
Write-Host "Pattern '$ExpectedShebang' found in '$($_.FullName)'" Write-Host "Pattern '$ExpectedShebang' found in '$RelativePath'"
} }
else { else {
Write-Host "Pattern '$ExpectedShebang' not found in '$($_.FullName)'" Write-Host "Pattern '$ExpectedShebang' not found in '$RelativePath'"
$ScriptWithoutShebangLine += $($_.FullName) $ScriptWithoutShebangLine += $RelativePath
} }
} }
return $ScriptWithoutShebangLine return $ScriptWithoutShebangLine