mirror of
https://github.com/fleschutz/PowerShell.git
synced 2025-06-28 07:51:43 +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
|
#!/usr/bin/pwsh
|
||||||
<#
|
<#
|
||||||
.SYNTAX cd-up.ps1 [<number>]
|
.SYNTAX cd-up.ps1
|
||||||
.DESCRIPTION go one or multiple directories up
|
.DESCRIPTION go one directory up
|
||||||
.LINK https://github.com/fleschutz/PowerShell
|
.LINK https://github.com/fleschutz/PowerShell
|
||||||
.NOTES Author: Markus Fleschutz / License: CC0
|
.NOTES Author: Markus Fleschutz / License: CC0
|
||||||
#>
|
#>
|
||||||
|
|
||||||
param([int]$Number = 1)
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
$TargetDir = ""
|
$TargetDir = resolve-path ".."
|
||||||
do {
|
|
||||||
$TargetDir += "../"
|
|
||||||
$Number--
|
|
||||||
} while ($Number -ne 0)
|
|
||||||
$TargetDir = resolve-path $TargetDir
|
|
||||||
set-location "$TargetDir"
|
set-location "$TargetDir"
|
||||||
"📂$TargetDir"
|
"📂$TargetDir"
|
||||||
exit 0
|
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 pwd -value list-workdir.ps1 # pwd = print working directory
|
||||||
set-alias -name ll -value get-childitem # ll = list long
|
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 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 # one dir up
|
||||||
set-alias -name ... -value cd-up.ps1 2 # go 2 dirs up
|
set-alias -name ... -value cd-up2.ps1 # two dirs up
|
||||||
set-alias -name .... -value cd-up.ps1 3 # go 3 dirs up
|
set-alias -name .... -value cd-up3.ps1 # three dirs up
|
||||||
set-alias -name ..... -value cd-up.ps1 4 # go 4 dirs up
|
set-alias -name ..... -value cd-up4.ps1 # four dirs up
|
||||||
|
Loading…
x
Reference in New Issue
Block a user