Questions tagged [bash-completion]

Questions about command completion in the Bash Unix shell.

310 questions
0
votes
1 answer

Delegate Bash completion of function to command with additional arguments

I'm trying to enable Bash completion for my own function called kctxt() that delegates to kubectl as follows: kctxt() { if [[ -z ${1+x} ]]; then # show context if no arguments kubectl config current-context else # set new context via…
Erhhung
  • 967
  • 9
  • 14
0
votes
0 answers

Makefile w/ bash completion: bash completion fails to tab expand makefile phony targets

I am running a debian docker image on windows for development purposes with bash completion and build essential installed. Typically, I instrument out a project with mini-scripts of repeated functionality via the makefile .PHONY target system. …
Chris
  • 28,822
  • 27
  • 83
  • 158
0
votes
1 answer

git completion runs cTest

I am in a weird situation under Ubuntu 18.04.2 LTS (using bash) : I installed git via apt-get and everything works fine. However, when I want to autocomplete commands via git (I did not do anything for this to work, it is just a reflex to hit tab…
Scrimbibete
  • 182
  • 8
0
votes
1 answer

Enabling bash-completion disables the default behaviour of auto-completing filenames

My make version on macOS High Sierra Version 10.13.6 looks like this: $ make --version GNU Make 3.81 Copyright (C) 2006 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for…
Lone Learner
  • 18,088
  • 20
  • 102
  • 200
0
votes
1 answer

Bash complete with "@"-sign

I am trying to create an autocomplete script for scp. The script reads the user and hostname from my .ssh/config file My .ssh/config file looks like: Host host1 HostName host1 User userA port 22 Host host2 HostName host2 User…
0
votes
2 answers

bash-compl and bash-completion: no such file or directory

Whenever I open a terminal, the following errors pop out instantly: bash: /usr/share/bash-compl: No such file or directory bash: etion/bash_completion: No such file or directory Also, when I try to compile my ~/.bashrc I get the same errors. What…
0
votes
1 answer

Bash completion not working when environment variable defined

When I define an environment variable inline like this: env_variable=true command, my custom bash completion script fails. Example: user@host in /tmp/tmp.6DRvQAkpFe > ls user@host in /tmp/tmp.6DRvQAkpFe > docker-ssh container1 container2 container3…
Carey
  • 650
  • 1
  • 4
  • 16
0
votes
0 answers

dont replace previous input if only the substrings of COMPREPLY bash completion options shows to the user

I want to create bash autocomplete for ssh. I have an a large network, with about 10 level 1 domains, each containts about 20 2 level domains, it can contains level 3 domains or network equipment. All data stored in my DNS and I can transfer zone…
0
votes
1 answer

Bash-Completion with "::" special character in arguments does not work

Can not figure out, how to get the bash-completion work with arguments containing "::" like that, because compgen or complete take each entry as seperate word, I guess. cmd=./my_script _my_options() { local cur prev opts …
john s.
  • 476
  • 9
  • 21
0
votes
1 answer

Override bash completion for every command

I have a (possibly ill-advised) idea for improving tab completion based on the command history. Ideally, I'd want to apply this to every command in the terminal. Basically I'm looking for something like: complete -F _my_function * where the glob…
Mistodon
  • 627
  • 1
  • 5
  • 12
0
votes
1 answer

How can I write a shell completion hook for a multi-word prefix?

Let's say I want to write a custom shell completion function that fires only on git checkout . I can write a custom hook for git completion like this: complete -f -F _custom_completion_function git # bash compctl -f -K…
Sasgorilla
  • 2,403
  • 2
  • 29
  • 56
0
votes
0 answers

Bash completion for filenames only accessible via another program

I'm trying to implement bash completion for filenames where the list of names is retrieved by another program (e.g. pulled via the network). I've got it almost working, but the automatic escaping is causing me some problems. The code below is the…
LVA
  • 1
0
votes
1 answer

How to autocomplete the options for a command in SLES 12?

I have a service, say xyz. As of now, I can start, stop or restart that service using the command rcxyz start, rcxyz stop and rcxyz restart respectively. It is working fine. All that I want to do is, if I type rcxyz and press , I would like to…
0
votes
1 answer

Bash: SPACE-triggered completion

In bash, I would like to achieve the following workflow (prompt shown in brackets, _ is the cursor): Type "foo" ($ foo_) Press space. At this point: if foo is a function, say function foo() { printf "hello from foo" } space is printed ($ foo…
hyperio
  • 401
  • 3
  • 13
0
votes
0 answers

Bash Set cursor in prompt using expansion

I'm trying to set the cursor in place to make an autocompletion later in prompt, but I'm not achieving the desired result. The action goes like this: First, I define a variable to expand like a command I use very often my_command="script_name…
Greco
  • 172
  • 1
  • 11