mirror of
https://github.com/fleschutz/PowerShell.git
synced 2025-04-10 10:48:31 +02:00
Add cd-up2.ps1, cd-up3.ps1 and cd-up4.ps1
This commit is contained in:
parent
91bd47182f
commit
c556e36e69
@ -1,20 +1,13 @@
|
||||
#!/usr/bin/pwsh
|
||||
<#
|
||||
.SYNTAX cd-up.ps1 [<number>]
|
||||
.DESCRIPTION go one or multiple directories up
|
||||
.SYNTAX cd-up.ps1
|
||||
.DESCRIPTION go one directory up
|
||||
.LINK https://github.com/fleschutz/PowerShell
|
||||
.NOTES Author: Markus Fleschutz / License: CC0
|
||||
#>
|
||||
|
||||
param([int]$Number = 1)
|
||||
|
||||
try {
|
||||
$TargetDir = ""
|
||||
do {
|
||||
$TargetDir += "../"
|
||||
$Number--
|
||||
} while ($Number -ne 0)
|
||||
$TargetDir = resolve-path $TargetDir
|
||||
$TargetDir = resolve-path ".."
|
||||
set-location "$TargetDir"
|
||||
"📂$TargetDir"
|
||||
exit 0
|
||||
|
17
Scripts/cd-up2.ps1
Normal file
17
Scripts/cd-up2.ps1
Normal file
@ -0,0 +1,17 @@
|
||||
#!/usr/bin/pwsh
|
||||
<#
|
||||
.SYNTAX cd-up2.ps1
|
||||
.DESCRIPTION go two directories up
|
||||
.LINK https://github.com/fleschutz/PowerShell
|
||||
.NOTES Author: Markus Fleschutz / License: CC0
|
||||
#>
|
||||
|
||||
try {
|
||||
$TargetDir = resolve-path "../.."
|
||||
set-location "$TargetDir"
|
||||
"📂$TargetDir"
|
||||
exit 0
|
||||
} catch {
|
||||
write-error "ERROR: line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
|
||||
exit 1
|
||||
}
|
17
Scripts/cd-up3.ps1
Normal file
17
Scripts/cd-up3.ps1
Normal file
@ -0,0 +1,17 @@
|
||||
#!/usr/bin/pwsh
|
||||
<#
|
||||
.SYNTAX cd-up3.ps1
|
||||
.DESCRIPTION go three directories up
|
||||
.LINK https://github.com/fleschutz/PowerShell
|
||||
.NOTES Author: Markus Fleschutz / License: CC0
|
||||
#>
|
||||
|
||||
try {
|
||||
$TargetDir = resolve-path "../../.."
|
||||
set-location "$TargetDir"
|
||||
"📂$TargetDir"
|
||||
exit 0
|
||||
} catch {
|
||||
write-error "ERROR: line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
|
||||
exit 1
|
||||
}
|
17
Scripts/cd-up4.ps1
Normal file
17
Scripts/cd-up4.ps1
Normal file
@ -0,0 +1,17 @@
|
||||
#!/usr/bin/pwsh
|
||||
<#
|
||||
.SYNTAX cd-up4.ps1
|
||||
.DESCRIPTION go four directories up
|
||||
.LINK https://github.com/fleschutz/PowerShell
|
||||
.NOTES Author: Markus Fleschutz / License: CC0
|
||||
#>
|
||||
|
||||
try {
|
||||
$TargetDir = resolve-path "../../../.."
|
||||
set-location "$TargetDir"
|
||||
"📂$TargetDir"
|
||||
exit 0
|
||||
} catch {
|
||||
write-error "ERROR: line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
|
||||
exit 1
|
||||
}
|
@ -27,7 +27,7 @@ del alias:pwd -force
|
||||
set-alias -name pwd -value list-workdir.ps1 # pwd = print working directory
|
||||
set-alias -name ll -value get-childitem # ll = list long
|
||||
set-alias -name lsf -value list-dir.ps1 # lsf = list directory formatted
|
||||
set-alias -name .. -value cd-up.ps1 1 # go 1 dir up
|
||||
set-alias -name ... -value cd-up.ps1 2 # go 2 dirs up
|
||||
set-alias -name .... -value cd-up.ps1 3 # go 3 dirs up
|
||||
set-alias -name ..... -value cd-up.ps1 4 # go 4 dirs up
|
||||
set-alias -name .. -value cd-up.ps1 # one dir up
|
||||
set-alias -name ... -value cd-up2.ps1 # two dirs up
|
||||
set-alias -name .... -value cd-up3.ps1 # three dirs up
|
||||
set-alias -name ..... -value cd-up4.ps1 # four dirs up
|
||||
|
Loading…
Reference in New Issue
Block a user