Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pushd +NUMBER doesn't work #4091

wgslr opened this issue Jun 1, 2017 · 2 comments

pushd +NUMBER doesn't work #4091

wgslr opened this issue Jun 1, 2017 · 2 comments


Copy link

@wgslr wgslr commented Jun 1, 2017

I'm using fish version 2.5.0. The documentation for pushd says

pushd +NUMBER rotates the stack counter-clockwise i.e. from bottom to top
pushd -NUMBER rotates clockwise i.e. top to bottom.

But all I get is

~> dirs
/tmp/c /tmp/b /tmp/a /tmp
~> pushd +1
cd: The directory “+1” does not exist

Steps to reproduce:

  1. Create temporary environment as suggested in the issue creation template: sh -c 'env HOME=$(mktemp -d) fish'
  2. Create subdirectories:
/tmp> mkdir a b c
  1. Create some dirs stack:
/tmp> pushd a
/tmp/a> pushd ../b
/tmp/b> pushd ../c
/tmp/c> dirs
/tmp/c /tmp/b /tmp/a /tmp
  1. Try to use pushd +1:
/tmp/c> pushd +1
cd: The directory “+1” does not exist
/tmp/c> dirs
/tmp/c /tmp/c /tmp/b /tmp/a /tmp

Expected result:

Current directory changed to /tmp/b, dirs stack is /tmp b /tmp/a /tmp /tmp/c

@krader1961 krader1961 self-assigned this Jun 2, 2017
@krader1961 krader1961 added this to the fish 2.7.0 milestone Jun 2, 2017
Copy link

@krader1961 krader1961 commented Jun 2, 2017

Introduced by commit 3702616, 2016-08-28, which was trying to do the right thing by switching to local variables in the function but introduced them inside a if...end block which means they aren't visible to the rest of the function.

Copy link

@faho faho commented Jun 2, 2017

The issue is this:

if count $argv
   set -l rot_l

# And now we're using rot_l
@krader1961 krader1961 closed this in ee646c8 Jun 2, 2017
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Apr 17, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
3 participants
You can’t perform that action at this time.