I want to create a bash completion script which recognises arguments of the form --arg and --some-arg=file.
After reading this tutorial and some examples in /usr/share/bash_completion/completions/, I've written the following script (to save time at typing some flags with Chromium):
_chromium()
{
local cur prev opts
COMPREPLY=()
cur="${COMP_WORDS[COMP_CWORD]}"
prev="${COMP_WORDS[
I'm trying to setup a bash completion, and have two problems
For parameter one, I needed a completion for directories
For parameter two, a fixed array for completion, I just don't know how to let bash make a selection, before I always used a perl script for complex ones.
_some_func()
{
case $COMP_CWORD in
1)
# default completion ?
Hello there!
I have a utility that takes a load of different arguments. For now, I want to autocomplete the first argument, but leave all the others to fall through to normal autocompletion.
I wrote two functions push and pull to copy files to and from a directory ($FILE_EXCHANGE_DIR). I want bash to autocomplete names from that directory when I use the pull function. I want the autocompletion to only take names from the said directory.
After a recent upgrade to 12.04, auto tab completion was disable in /etc/bash.bashrc. I uncommented the following lines:
if [ -f /etc/bash_completion ] && ! shopt -oq posix; then
. /etc/bash_completion
fi
I tried to then run source /etc/bash.bashrc and . /etc/bash.bashrc but neither reloaded the config. They just gave me the error -sh: 1: source: not found.
I have a script for auto-completing my ssh-hosts. If I change my ~/.ssh/config the auto-completion is not updated automatically, though. This does not surprise me. In a new shell, the new entry is picked up and usable, of course.
How do I manually trigger a refresh of the completion in bash?
I just updated to fedora 18, and I find the auto completion does not work properly. I use bash for years..
auto completion works fine for command like 'cat', 'ls', 'cd', but for 'vi', it does not. It always append 'bash' after and complains aroread: command not found..
I'm sorry for asking another question of this type.
This question is quite similar to this one, but I can't understand the solution.