You are not logged in.

#1 2022-11-18 00:24:11

lenhuppe
Member
From: New Hampshire USA
Registered: 2018-12-10
Posts: 282
Website

SOLVED Tab completion / path question

When I am at the console of my custom ISO zsh can find my scripts in /usr/loca/bin using tab completion. However when I am at a console in my booted system bash is not able to find my scripts in /usr/loca/bin using tab completion. This has not been in issue since I am in the habit of using full paths when testing my scripts.
However today I decided to peak at /etc/profile to see how PATH is being set. I found 'export PATH' instead of 'export $PATH' in there. When I changed PATH to $PATH tab completion started working.

I am no guru so I have to wonder if there is a reason for having PATH instead of $PATH?

Last edited by lenhuppe (2022-11-26 19:14:08)


"I'm suspicious of people who don't like dogs, but I trust a dog when it doesn't like a person."  -- Bill Murray

Offline

#2 2022-11-18 00:29:48

V1del
Forum Moderator
Registered: 2012-10-16
Posts: 23,430

Re: SOLVED Tab completion / path question

You are exporting the variable, not the content of the variable

export $PATH

will export the contents and not the variable and will most likely fail due to being an illegal construct.

You used /usr/loca/bin without the l twice. Are you actually setting the $PATH variable yourself somehow in  a way that would have a problem were it already set? What's your actual output of

echo $PATH 

for you?

Last edited by V1del (2022-11-18 00:32:53)

Offline

#3 2022-11-18 00:52:30

lenhuppe
Member
From: New Hampshire USA
Registered: 2018-12-10
Posts: 282
Website

Re: SOLVED Tab completion / path question

V1del wrote:

You are exporting the variable, not the content of the variable

export $PATH

will export the contents and not the variable and will most likely fail due to being an illegal construct.

You used /usr/loca/bin without the l twice. Are you actually setting the $PATH variable yourself somehow in  a way that would have a problem were it already set? What's your actual output of

echo $PATH 

for you?

I meant /usr/local/bin ... that was a typo

echo $PATH

/usr/local/sbin:/usr/local/bin:/usr/bin:/usr/lib/jvm/default/bin:/usr/bin/site_perl:/usr/bin/vendor_perl:/usr/bin/core_perl

Last edited by lenhuppe (2022-11-18 01:22:32)


"I'm suspicious of people who don't like dogs, but I trust a dog when it doesn't like a person."  -- Bill Murray

Offline

#4 2022-11-18 08:10:59

seth
Member
Registered: 2012-09-03
Posts: 59,718

Re: SOLVED Tab completion / path question

When I changed PATH to $PATH tab completion started working.

https://www.merriam-webster.com/dictionary/coincidence
As V1del pointed out "export $PATH" will just cause an error and you should undo that.

In what context did you "echo $PATH"?
bash? zsh?

What likely happens is that you extend the $PATH to include /usr/local/bin in a file that'S only sourced by zsh - then, while testing, you either explicitly sourced that file or moved from a zsh to a bash, carrying over the exported $PATH

zsh
export FOO=BAR
bash
echo $FOO

Whatever the scenario is: "export $PATH" did *NOT* fix anything for you for sure.

Edit: afacis the default /etc/profile already adds /usr/local/bin to the PATH - what does your copy look like?

Last edited by seth (2022-11-18 08:13:28)

Offline

#5 2022-11-18 13:23:11

lenhuppe
Member
From: New Hampshire USA
Registered: 2018-12-10
Posts: 282
Website

Re: SOLVED Tab completion / path question

seth wrote:

In what context did you "echo $PATH"?
bash? zsh?

A bash console and also a terminal app ... the results were the same.

The difference in behavior between zsh and bash was caused by having fzf completion enabled in bash.
When I disabled fzf completion in bash it did a full path search and found my custom script files.

Last edited by lenhuppe (2022-11-18 19:41:52)


"I'm suspicious of people who don't like dogs, but I trust a dog when it doesn't like a person."  -- Bill Murray

Offline

#6 2022-11-26 19:13:50

lenhuppe
Member
From: New Hampshire USA
Registered: 2018-12-10
Posts: 282
Website

Re: SOLVED Tab completion / path question

Solution:

When enabling fzf in bash the sequence is important

source /usr/share/fzf/key-bindings.bash
source /usr/share/fzf/completion.bash
source /usr/share/fzf/<custom>.bash

Also when using sudo on my scripts I have to fill in the full path with tab completion.


"I'm suspicious of people who don't like dogs, but I trust a dog when it doesn't like a person."  -- Bill Murray

Offline

Board footer

Powered by FluxBB