You are not logged in.

#1 2022-11-09 15:25:19

Der Chefkoch
Member
Registered: 2020-12-05
Posts: 100

[SOLVED] Bash Completion for Custom Folder

I keep my home-cooked bash scripts in a folder and added the path to .bashrc:

PATH="$PATH:/$HOME/scripts

So now I can call those scripts from other directories, however the autocompletion is not working which would be useful.

Is it possible to make the entire content of the "scripts" folder available to bash autocompletion?

Cheers

Last edited by Der Chefkoch (2022-11-09 16:24:41)

Offline

#2 2022-11-09 15:50:45

seth
Member
From: Won't reply 2 private help req
Registered: 2012-09-03
Posts: 76,432

Re: [SOLVED] Bash Completion for Custom Folder

bash completes executables out of the entire $PATH, but "PATH="$PATH:/$HOME/scripts" has a stray quotation mark and the leading "/" before $HOME should also not be there.

echo $PATH

Online

#3 2022-11-09 16:24:21

Der Chefkoch
Member
Registered: 2020-12-05
Posts: 100

Re: [SOLVED] Bash Completion for Custom Folder

Thanks, well turns out everything is working I guess. "echo $PATH" properly displayed the path, the - correctly spotted - stray quotation mark just missed the ending quotation mark that I dropped during copy/paste.

I had the habit of calling the scripts via

sh scriptX.sh

... where the autocompletion does not work after the sh-command. Since autocompletion works this way when the sh script is in the current working directory I assumed that should then work globally.

However, setting the .sh File to executable allows calling it via autocomplete.

Thx for the time

Offline

Board footer

Powered by FluxBB