rupa / z

z - jump around
Do What The F*ck You Want To Public License
16.32k stars 1.17k forks source link

/bin/bash: z: command not found #320

Closed Paulie420 closed 1 year ago

Paulie420 commented 1 year ago

So I've added z.sh to a ~/Templates directory and added: . ~/Templates/z.sh to my .bashrc; when I use z [SOME DIR] it DOES populate, but when I press enter I get

/bin/bash: z: command not found

What am I stupidly doing wrong????

Lockszmith-GH commented 1 year ago

Not the maintainer, but I started using z not too long ago, so would be happy to try and help troubleshoot:

This is what I get after z is loaded:

> type -t z
alias
> alias z
alias z='_z 2>&1'
> type -t _z
function
> complete | grep '\bz$' 
complete -o filenames -C '_z --complete "$COMP_LINE"' z

What happens when you run _z [SOME DIR] ?

If _z worked, I'm guessing the alias isn't set for some reason.

To better understand what happens when you load your .bashrc, try running the following command:

bash -x ~/.bashrc

It will output each command after it's executed - providing you with details about the execution.

If you got to this point, and can't figure out what's going on, please paste the output as a replay over here (I recommend you use the <details><summary> tags)

Paulie420 commented 1 year ago

I figured out the issue, and a fix - but I don't understand why it happened: I have an alias named alias, that i had BEFORE the entry for loading z.sh in my .bashrc... I moved the z line before that alias, named alias, and it now works perfectly.

I know that having an alias named alias has to be after all other aliases - and assume its not the smartest alias name; but z is working now. THANK YOU for replying. SOLVED.

Lockszmith-GH commented 1 year ago

Could you share with us what your alias alias does?