mirror of
https://github.com/fleschutz/PowerShell.git
synced 2025-06-30 12:41:46 +02:00
Added search-files.ps1
This commit is contained in:
29
Scripts/search-files.ps1
Executable file
29
Scripts/search-files.ps1
Executable file
@ -0,0 +1,29 @@
|
||||
#!/snap/bin/powershell
|
||||
|
||||
# Syntax: ./search-files.ps1 [<pattern>] [<path>]
|
||||
# Description: searches the given pattern in the given files
|
||||
# Author: Markus Fleschutz
|
||||
# Source: github.com/fleschutz/PowerShell
|
||||
# License: CC0
|
||||
|
||||
param([String]$Pattern, [String]$Path)
|
||||
|
||||
Set-StrictMode -Version Latest
|
||||
|
||||
try {
|
||||
if ($Pattern -eq "" ) {
|
||||
$Pattern = read-host "Enter search pattern"
|
||||
}
|
||||
if ($Path -eq "" ) {
|
||||
$Path = read-host "Enter path to files"
|
||||
}
|
||||
|
||||
$List = Select-String -Path $Path -Pattern "$Pattern"
|
||||
foreach ($Item in $List) {
|
||||
write-output "$($Item.Path) @$($Item.LineNumber)`t$($Item.Line)"
|
||||
}
|
||||
exit 0
|
||||
} catch {
|
||||
write-error "ERROR in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
|
||||
exit 1
|
||||
}
|
@ -1,7 +1,7 @@
|
||||
#!/snap/bin/powershell
|
||||
|
||||
# Syntax: ./turn-volume-down.ps1 [<percent>]
|
||||
# Description: turns the volume down (-10% by default)
|
||||
# Description: turns the audio volume down (-10% by default)
|
||||
# Author: Markus Fleschutz
|
||||
# Source: github.com/fleschutz/PowerShell
|
||||
# License: CC0
|
||||
|
@ -1,7 +1,7 @@
|
||||
#!/snap/bin/powershell
|
||||
|
||||
# Syntax: ./turn-volume-up.ps1 [<percent>]
|
||||
# Description: turns the volume up (+10% by default)
|
||||
# Description: turns the audio volume up (+10% by default)
|
||||
# Author: Markus Fleschutz
|
||||
# Source: github.com/fleschutz/PowerShell
|
||||
# License: CC0
|
||||
|
Reference in New Issue
Block a user