Hacker News new | ask | show | jobs
by juki 1321 days ago
`dirs -v` would be `Get-Location -Stack`. Also in newish versions PowerShell `Set-Location` (aliased to `cd`) supports -/+ to move backwards/forwards in it's own history, so usually you don't even need to bother with `pushd`/`popd` unless you need a named stack.
1 comments

what about pushd 7 to go to the 7th path in the stack?
Just get the 7th path from `Get-Location` and `Set-Location` there, e.g.

  function Set-StackLocation ($Position) {
    (gl -Stack).Path | select -Index $Position | cd
  }
Seems like a lot of work for something that's just built into bash and is extremely useful.
Like all shells, PowerShell is split between being a scripting language and an interactive shell.

PowerShell leans a bit more towards being a scripting language than an interactive shell, so things are more verbose, as befits a shell script that needs to be read and updated later by a different programmer.

But yeah, lots of little trade offs like that permeate the language.

Less work than trying to add named stacks to bash. If it's so central to your workflow that you're willing to put up with the rest of bash just for it, adding a couple lines to your profile can't be that big of a deal.
Well, it's the first time I saw the magic incantation listed above so I may give it another try know.