Define cd to work more like Unix/Linux: * No path argument changes to the users home directory * Passing "-" for the path argument changes to the previous directory
17 lines
472 B
PowerShell
17 lines
472 B
PowerShell
# Define cd to work more like Unix/Linux:
|
|
# * No path argument changes to the users home directory
|
|
# * Passing "-" for the path argument changes to the previous directory
|
|
$Global:cdPreviousPath = Get-Location
|
|
function cd {
|
|
Param ([string]$Path)
|
|
if ($Path -eq "") {
|
|
$Path = "~"
|
|
} elseif ($Path -eq "-") {
|
|
$Path = $cdPreviousPath
|
|
}
|
|
$Global:cdPreviousPath = Get-Location
|
|
Set-Location -Path $Path
|
|
}
|
|
|
|
# TODO: Define rm to work with -rf and multiple entries
|